123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Data;
- using System.Drawing;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.Software.MainBusiness.TimeAndAttendance
- {
- public class A_EmployeeScheduleSmallFlighting : LYFZ.Software.UI.TimeAndAttendance.A_EmployeeScheduleSmallFlighting
- {
- public DataSet dtSet = new DataSet();
- public DataSet dtSet1 = new DataSet();
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- public A_EmployeeScheduleSmallFlighting()
- {
- this.Load += A_EmployeeScheduleSmallFlighting_Load;
- this.btnReservation.Click += btnReservation_Click;
- this.btnClose.Click += btnClose_Click;
- }
- /// <summary>
- /// 工作内容ID串
- /// </summary>
- public string StrJobsID = "";
- /// <summary>
- /// 工作项目串
- /// </summary>
- public string StrJobsText = "";
- /// <summary>
- /// 选择的要显示内容
- /// </summary>
- public string StrShowText = "";
- /// <summary>
- /// 选择的日期
- /// </summary>
- public string StrDateTime = "";
- /// <summary>
- /// 是否保存
- /// </summary>
- public bool IsSaveed = false;
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void A_EmployeeScheduleSmallFlighting_Load(object sender, EventArgs e)
- {
- if (!string.IsNullOrEmpty(this.StrJobsID))
- {
- string[] StrArrayJobsID = this.StrJobsID.Trim().Split(',');
- string[] StrArrayJobsText = this.StrJobsText.Trim().Split(',');
- Hashtable htDataGroupCount = new Hashtable();
- for (int i = 0; i < StrArrayJobsText.Length; i++)
- {
- if (htDataGroupCount.ContainsKey(StrArrayJobsText[i].Trim()))
- {
- int intCount = Convert.ToInt32(htDataGroupCount[StrArrayJobsText[i].Trim()].ToString().Trim()) + 1;
- htDataGroupCount[StrArrayJobsText[i].Trim()] = intCount;
- }
- else
- { htDataGroupCount[StrArrayJobsText[i].Trim()] = 1; }
- }
- string StrGroupJobsText = "";
- foreach (DictionaryEntry item in htDataGroupCount)
- {
- StrGroupJobsText += item.Key.ToString().Trim() + ":" + item.Value.ToString().Trim() + "组;";
- }
- labelEx1.Text = this.StrShowText.Trim() + " " + StrGroupJobsText;
- string strColumn = "订单编号,景点,时间,订单号,订单类型,套系名称,客户姓名,性别,电话,QQ,负责";
- this.dgvData.DataColumns(strColumn, strHideField: "订单编号");
- this.dgvData.Columns["时间"].Width = 110;
- DataTable dt = new DataTable();
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, System.ComponentModel.BackgroundWorker backgroundWorker)
- {
- string StrWhere = LYFZ.BLL.OtherCommonModel.GetDateTime("Ordpg_ReservationPhotographyTime", this.StrDateTime, this.StrDateTime, ConnectWord: "");
- string StrArray = "";
- for (int i = 0; i < StrArrayJobsID.Length; i++)
- {
- if (!string.IsNullOrEmpty(StrArrayJobsID[i].Trim()))
- { StrArray += "'" + StrArrayJobsID[i].Trim() + "',"; }
- }
- if (!string.IsNullOrEmpty(StrArray.Trim()))
- { StrWhere += " And tb_ErpOrder.ID in (" + StrArray.TrimEnd(',') + ")"; }
- dt = orbll.GetView_Custom("tb_ErpOrder Left Join tempTB_AggregationCustomer on GP_OrderNumber = Ord_Number Left Join tb_ErpOrdersPhotography on Ordpg_Number = Ord_Number", StrWhere: StrWhere, ShowColumnName: "tb_ErpOrder.ID,Ord_Number,Ord_SinceOrderNumber,dbo.fn_CheckOrderType(Ord_Type) AS Ord_Type,Ord_SeriesName,Cus_Name,M_Cus_Sex_cs,M_Cus_Telephone,M_Cus_QQ,Ordpg_Sights,Ordpg_ReservationPhotographyTime", filedOrder: "Ordpg_ReservationPhotographyTime,Ord_Number").Tables[0];
- });
- DataGridViewRow dgvr = null;
- DataGridViewCell cell = null;
- bool IsTrue = true;
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- dgvr = new DataGridViewRow();
- cell = new DataGridViewTextBoxCell();
- cell.Value = dt.Rows[i]["Ord_Number"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = dt.Rows[i]["Ordpg_Sights"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = LYFZ.BLL.OtherCommonModel.DateTimeToString(dt.Rows[i]["Ordpg_ReservationPhotographyTime"]);
- dgvr.Cells.Add(cell);
- bool IsFind = false;
- if (i > 0)
- {
- if (dt.Rows[i]["Ord_Number"].ToString().Trim() == dt.Rows[i - 1]["Ord_Number"].ToString().Trim())
- { IsFind = true; }
- }
- else
- { dgvr.DefaultCellStyle.BackColor = this.dgvData.DataGridViewRowsBackColor_Single(); }
- if (!IsFind)
- {
- if (IsTrue)
- {
- dgvr.DefaultCellStyle.BackColor = this.dgvData.DataGridViewRowsBackColor_Double();
- IsTrue = false;
- }
- else
- {
- dgvr.DefaultCellStyle.BackColor = this.dgvData.DataGridViewRowsBackColor_Single();
- IsTrue = true;
- }
- cell = new DataGridViewTextBoxCell();
- cell.Value = dt.Rows[i]["Ord_SinceOrderNumber"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = dt.Rows[i]["Ord_Type"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = dt.Rows[i]["Ord_SeriesName"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = dt.Rows[i]["Cus_Name"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = dt.Rows[i]["M_Cus_Sex_cs"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = dt.Rows[i]["M_Cus_Telephone"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = dt.Rows[i]["M_Cus_QQ"].ToString().Trim();
- dgvr.Cells.Add(cell);
- string JobsText = "";
- for (int j = 0; j < StrArrayJobsID.Length; j++)
- {
- if (StrArrayJobsID[j].Trim() == dt.Rows[i]["ID"].ToString().Trim())
- { JobsText = StrArrayJobsText[j].TrimEnd(); break; }
- }
- cell = new DataGridViewTextBoxCell();
- cell.Value = JobsText.Trim();
- dgvr.Cells.Add(cell);
- }
- else
- {
- dgvr.DefaultCellStyle.BackColor = this.dgvData.Rows[this.dgvData.Rows.Count - 1].DefaultCellStyle.BackColor;
- for (int j = 0; j < 8; j++)
- {
- cell = new DataGridViewTextBoxCell();
- cell.Value = "";
- dgvr.Cells.Add(cell);
- }
- }
- this.dgvData.Rows.Add(dgvr);
- }
- }
- }
- /// <summary>
- /// 安排预约
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnReservation_Click(object sender, EventArgs e)
- {
- if (this.dgvData.SelectedRows.Count > 0)
- {
- MakeAnAppointment frm = new MakeAnAppointment();
- frm.ShowDialog();
- if (frm.IsSaveed)
- { this.IsSaveed = LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.LoadForm(frm.StrSelectType, this.dgvData.SelectedRows[0].Cells["订单编号"].Value.ToString().Trim()); }
- }
- else
- { MessageBoxCustom.Show("请选择你要安排的订单!"); }
- }
- /// <summary>
- /// 关闭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnClose_Click(object sender, EventArgs e)
- { this.Close(); }
- }
- }
|