void LoadComBox() { BaseData.Store store = new BaseData.Store(); store.StoreDT = store.SelectAllStoreInfo(); foreach (DataRow dr in store.StoreDT.Rows) { cbDeliverStore.Items.Add(dr["StoreName"].ToString()); } if (cbDeliverStore.Items.Count > 0) { cbDeliverStore.SelectedIndex = 0; } foreach (DataRow dr in store.StoreDT.Rows) { cbRecieveStore.Items.Add(dr["StoreName"].ToString()); } if (cbRecieveStore.Items.Count > 0) { cbRecieveStore.SelectedIndex = 0; } cboExchangeType.Items.Add("N/A"); cboExchangeType.Items.Add("新店预留"); cboExchangeType.Items.Add("Pull Back"); cboExchangeType.SelectedIndex = 0; }
private void BtnSubmitAddApp_Click(object sender, EventArgs e) { BaseData.Store store = new BaseData.Store(); //if (store.SelectStoreInfoByStoreName(txtDeliverStore4.Text).Rows.Count == 0 || store.SelectStoreInfoByStoreName(txtReceiptStore4.Text).Rows.Count == 0) //{ // MessageBox.Show("收发店铺名错误"); //} if (AddApplicationDT.Rows.Count == 0) { MessageBox.Show("表中未添加转货内容"); } else if (txtCtrlID.Text == null || txtCtrlID.Text.Length == 0) { MessageBox.Show("请填写控制单号"); } else { int TotalCount = 0; double TotalPrice = 0; DataTable AddAppInfoDT = applicationInfo.SelectApplicationByCtrlID(applicationInfo.CtrlID); AddAppInfoDT.Rows[0]["WuliuID"] = txtWuliuID.Text; if (DeliverOrReceipt == "Deliver") { AddAppInfoDT.Rows[0]["DeliverDate"] = dtAppDate.Value; AddAppInfoDT.Rows[0]["DeliverCheck"] = txtStoreCheck.Text; } else { AddAppInfoDT.Rows[0]["ReceiptDate"] = dtAppDate.Value; AddAppInfoDT.Rows[0]["ReceiptCheck"] = txtStoreCheck.Text; } try { AddApplicationDT.AcceptChanges(); AddAppInfoDT.AcceptChanges(); if (DeliverOrReceipt == "Deliver") { applicationDetail.UpdateDeliverDetail(AddApplicationDT); applicationInfo.UpdateApplicationInfo(AddAppInfoDT); } else { applicationDetail.UpdateReceiptDetail(AddApplicationDT); applicationInfo.UpdateApplicationInfo(AddAppInfoDT); } MessageBox.Show("提交成功", "消息", MessageBoxButtons.OK, MessageBoxIcon.Information); DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { MessageBox.Show("提交失败,错误信息:" + ex.Message); } } }
void LoadComBox() { BaseData.Store store = new BaseData.Store(); store.StoreDT = store.SelectAllStoreInfo(); foreach (DataRow dr in store.StoreDT.Rows) { cbDeliverStore.Items.Add(dr["StoreName"].ToString()); } if (cbDeliverStore.Items.Count > 0) { //cbDeliverStore.SelectedItem = Login.LoginUser.Store; cbDeliverStore.SelectedIndex = 0; } //foreach (DataRow dr in store.StoreDT.Rows) //{ // cbRecieveStore.Items.Add(dr["StoreName"].ToString()); //} //if (cbRecieveStore.Items.Count > 0) //{ // //cbRecieveStore.SelectedIndex = 0; // cbRecieveStore.SelectedItem = Login.LoginUser.Store; //} string[] strStoreTemp = Login.LoginUser.Store.ToString().Split(','); if (strStoreTemp[0] != "" && strStoreTemp[0] != null && strStoreTemp.Length > 1) { for (int i = 0; i < strStoreTemp.Length; i++) { if (strStoreTemp[i].ToString() != null && strStoreTemp[i].ToString() != "") { cbRecieveStore.Items.Add(strStoreTemp[i].ToString()); } } } else { cbRecieveStore.Items.Add(strStoreTemp[0]); } if (cbRecieveStore.Items.Count > 0) { cbRecieveStore.SelectedIndex = 0; } cboExchangeType.Items.Add("N/A"); cboExchangeType.Items.Add("新店预留"); cboExchangeType.Items.Add("Pull Back"); cboExchangeType.SelectedIndex = 0; }
private void BtnSubmitAddApp_Click(object sender, EventArgs e) { BaseData.Store store = new BaseData.Store(); //if (store.SelectStoreInfoByStoreName(txtDeliverStore4.Text).Rows.Count == 0 || store.SelectStoreInfoByStoreName(txtReceiptStore4.Text).Rows.Count == 0) //{ // MessageBox.Show("收发店铺名错误"); //} if (AddApplicationDT.Rows.Count == 0) { MessageBox.Show("申请表中未添加转货内容"); } else if (txtCtrlID.Text == null || txtCtrlID.Text.Length == 0) { MessageBox.Show("请填写控制单号"); } else if (cbDeliverStore.SelectedItem.ToString() == cbRecieveStore.SelectedItem.ToString()) { MessageBox.Show("收发店面相同,无法添加"); } else { int TotalCount = 0; double TotalPrice = 0; DataTable AddAppInfoDT = applicationInfo.SelectApplicationByCtrlID("0"); DataRow dr = AddAppInfoDT.NewRow(); dr["CtrlID"] = txtCtrlID.Text; dr["DeliverStore"] = cbDeliverStore.SelectedItem.ToString(); dr["ReceiptStore"] = cbRecieveStore.SelectedItem.ToString(); dr["ApplicantsDate"] = DateTime.Now; dr["ApplicantsName"] = txtApplicant.Text; dr["ApplicantsPos"] = txtApplicantPos.Text; dr["Applicants"] = Login.LoginUser.UID; dr["Alert_Approval"] = 0; dr["Alert_Deliver"] = 0; dr["Alert_Receipt"] = 0; dr["ExchangeType"] = cboExchangeType.SelectedItem.ToString(); foreach (DataRow addDr in AddApplicationDT.Rows) { addDr["CtrlID"] = dr["CtrlID"]; TotalCount += (int)addDr["App_Count"]; TotalPrice += ((int)addDr["App_Count"]) * ((double.Parse(addDr["Price"].ToString()))); } dr["TotalCount"] = TotalCount; dr["TotalPrice"] = TotalPrice; AddAppInfoDT.Rows.Add(dr); if (TotalPrice > EmailControl.config.UpperLimit) { DialogResult dres = MessageBox.Show("超出限额,是否继续提交?", "消息", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (dres == DialogResult.OK) { try { applicationInfo.SubmitApplicationInfo(AddAppInfoDT); applicationDetail.SubmitApplicationDetail(AddApplicationDT); Thread thread = new Thread(new ThreadStart(SendEmail)); thread.Start(); MessageBox.Show("提交成功", "消息", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } catch (Exception ex) { MessageBox.Show("提交失败,错误信息:" + ex.Message); } } } else { try { applicationInfo.SubmitApplicationInfo(AddAppInfoDT); applicationDetail.SubmitApplicationDetail(AddApplicationDT); Thread thread = new Thread(new ThreadStart(SendEmail)); thread.Start(); MessageBox.Show("提交成功", "消息", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } catch (Exception ex) { MessageBox.Show("提交失败,错误信息:" + ex.Message); } } } }
private void BtnSubmitAddApp_Click(object sender, EventArgs e) { BaseData.Store store = new BaseData.Store(); //if (store.SelectStoreInfoByStoreName(txtDeliverStore4.Text).Rows.Count == 0 || store.SelectStoreInfoByStoreName(txtReceiptStore4.Text).Rows.Count == 0) //{ // MessageBox.Show("收发店铺名错误"); //} if (txtWuliuID.Text.Length < 1 && DeliverOrReceipt == "待发货") { MessageBox.Show("请填写物流单号"); } else if (AddApplicationDT.Rows.Count == 0) { MessageBox.Show("申请表中未添加转货内容"); } else if (txtCtrlID.Text == null || txtCtrlID.Text.Length == 0) { MessageBox.Show("请填写控制单号"); } else { DataTable AddAppInfoDT = applicationInfo.SelectApplicationByCtrlID(applicationInfo.CtrlID); if (AddAppInfoDT.Rows.Count > 0) { AddAppInfoDT.Rows[0]["WuliuID"] = txtWuliuID.Text; if (DeliverOrReceipt == "待发货") { AddAppInfoDT.Rows[0]["DeliverDate"] = dtAppDate.Value; AddAppInfoDT.Rows[0]["DeliverCheck"] = txtStoreCheck.Text; } else if (DeliverOrReceipt == "待收货") { AddAppInfoDT.Rows[0]["ReceiptDate"] = dtAppDate.Value; AddAppInfoDT.Rows[0]["ReceiptCheck"] = txtStoreCheck.Text; } } try { if (DeliverOrReceipt == "待发货") { applicationDetail.UpdateDeliverDetail(AddApplicationDT); applicationInfo.UpdateApplicationInfo(AddAppInfoDT); applicationInfo.DeliverConfirm(applicationInfo.CtrlID, txtStoreCheck.Text, Login.LoginUser, 1); Thread thread = new Thread(new ThreadStart(SendEmailtoReceipt)); thread.Start(); } else if (DeliverOrReceipt == "待收货") { applicationDetail.UpdateReceiptDetail(AddApplicationDT); applicationInfo.UpdateApplicationInfo(AddAppInfoDT); applicationInfo.ReceiptConfirm(applicationInfo.CtrlID, txtStoreCheck.Text, Login.LoginUser, 1); Thread thread = new Thread(new ThreadStart(SendEmailtoWuliu)); thread.Start(); } MessageBox.Show("提交成功", "消息", MessageBoxButtons.OK, MessageBoxIcon.Information); DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { MessageBox.Show("提交失败,错误信息:" + ex.Message); } } }
private void BtnSubmitAddApp_Click(object sender, EventArgs e) { BaseData.Store store = new BaseData.Store(); //if (store.SelectStoreInfoByStoreName(txtDeliverStore4.Text).Rows.Count == 0 || store.SelectStoreInfoByStoreName(txtReceiptStore4.Text).Rows.Count == 0) //{ // MessageBox.Show("收发店铺名错误"); //} if (AddApplicationDT.Rows.Count == 0) { MessageBox.Show("申请表中未添加转货内容"); } else if (txtCtrlID.Text == null || txtCtrlID.Text.Length == 0) { MessageBox.Show("请填写控制单号"); } else { frmEditReason fer = new frmEditReason(applicationInfo.EditReason); if (fer.ShowDialog() == DialogResult.OK) { int TotalCount = 0; double TotalPrice = 0; DataTable AddAppInfoDT = applicationInfo.SelectApplicationByCtrlID(applicationInfo.CtrlID); AddAppInfoDT.Rows[0]["EditReason"] = fer.EditReasonString; AddAppInfoDT.Rows[0]["CtrlID"] = txtCtrlID.Text; AddAppInfoDT.Rows[0]["DeliverStore"] = cbDeliverStore.SelectedItem.ToString(); AddAppInfoDT.Rows[0]["ReceiptStore"] = cbRecieveStore.SelectedItem.ToString(); AddAppInfoDT.Rows[0]["ApplicantsDate"] = dtAppDate.Value; AddAppInfoDT.Rows[0]["ApplicantsName"] = txtApplicant.Text; AddAppInfoDT.Rows[0]["ApplicantsPos"] = txtApplicantPos.Text; AddAppInfoDT.Rows[0]["Applicants"] = Login.LoginUser.UID; AddAppInfoDT.Rows[0]["ExchangeType"] = cboExchangeType.SelectedItem.ToString(); foreach (DataGridViewRow addDr in dgvApplyProducts.Rows) { //addDr["CtrlID"] = AddAppInfoDT.Rows[0]["CtrlID"]; TotalCount += (int)addDr.Cells["numbers"].Value; TotalPrice += ((int)addDr.Cells["numbers"].Value) * ((double.Parse(addDr.Cells["price"].Value.ToString()))); } AddAppInfoDT.Rows[0]["TotalCount"] = TotalCount; AddAppInfoDT.Rows[0]["TotalPrice"] = TotalPrice; //foreach(DataRow dr in AddApplicationDT.Rows) //{ // dr["CtrlID"] = txtCtrlID.Text; //} if (Login.LoginUser.Character == 1) { if ((int)AddAppInfoDT.Rows[0]["ApprovalState"] != 1) { AddAppInfoDT.Rows[0]["ApprovalState"] = 0; } if ((int)AddAppInfoDT.Rows[0]["ApprovalState2"] != 1) { AddAppInfoDT.Rows[0]["ApprovalState2"] = 0; } if ((int)AddAppInfoDT.Rows[0]["DeliverState"] != 1) { AddAppInfoDT.Rows[0]["DeliverState"] = 0; } if ((int)AddAppInfoDT.Rows[0]["ReceiptState"] != 1) { AddAppInfoDT.Rows[0]["ReceiptState"] = 0; } } if (TotalPrice > EmailControl.config.UpperLimit) { DialogResult dres = MessageBox.Show("超出限额,是否继续提交?", "消息", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (dres == DialogResult.OK) { try { applicationInfo.UpdateApplicationInfo(AddAppInfoDT); applicationDetail.UpdateApplicationDetail(AddApplicationDT); MessageBox.Show("提交成功", "消息", MessageBoxButtons.OK, MessageBoxIcon.Information); DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { MessageBox.Show("提交失败,错误信息:" + ex.Message); } } } else { try { applicationInfo.UpdateApplicationInfo(AddAppInfoDT); applicationDetail.UpdateApplicationDetail(AddApplicationDT); MessageBox.Show("提交成功", "消息", MessageBoxButtons.OK, MessageBoxIcon.Information); DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { MessageBox.Show("提交失败,错误信息:" + ex.Message); } } } } }