private void GetCustomer(string phone) { if (!orderType.Equals(PubComm.ORDER_TYPE_SHOP)) { new SystemData().GetTaCustomer(); var lstCus = CommonData.TaCustomer.Where(s => s.cusPhone.ToString().Equals(phone)); if (lstCus.Any()) { TaCustomerInfo taCustomerInfo = lstCus.FirstOrDefault(); txtPhone.Text = taCustomerInfo.cusPhone; txtName.Text = taCustomerInfo.cusName; txtHouseNo.Text = taCustomerInfo.cusHouseNo; txtAddr.Text = taCustomerInfo.cusAddr; txtPostcode.Text = taCustomerInfo.cusPostcode; txtDistance.Text = taCustomerInfo.cusDistance; txtPcZone.Text = taCustomerInfo.cusPcZone; txtDelCharge.Text = taCustomerInfo.cusDelCharge; txtReadyTime.Text = taCustomerInfo.cusReadyTime; txtIntNotes.Text = taCustomerInfo.cusIntNotes; txtNoteOnBill.Text = taCustomerInfo.cusNotesOnBill; chkBlackList.Checked = taCustomerInfo.cusIsBlack.Equals("Y") ? true : false; txtNote.Text = taCustomerInfo.cusNote; } } }
/// <summary> /// 显示会员信息 /// </summary> private void GetCustomer() { if (!string.IsNullOrEmpty(callerID)) { new SystemData().GetTaCustomer(); var lstCus = CommonData.TaCustomer.Where(s => s.cusPhone.Equals(callerID)); if (lstCus.Any()) { TaCustomerInfo taCustomerInfo = lstCus.FirstOrDefault(); txtPhone.Text = taCustomerInfo.cusPhone; txtName.Text = taCustomerInfo.cusName; txtHouseNo.Text = taCustomerInfo.cusHouseNo; txtAddr.Text = taCustomerInfo.cusAddr; txtPostcode.Text = taCustomerInfo.cusPostcode; txtDistance.Text = taCustomerInfo.cusDistance; txtPcZone.Text = taCustomerInfo.cusPcZone; txtDelCharge.Text = taCustomerInfo.cusDelCharge; txtReadyTime.Text = taCustomerInfo.cusReadyTime; txtIntNotes.Text = taCustomerInfo.cusIntNotes; txtNoteOnBill.Text = taCustomerInfo.cusNotesOnBill; chkBlackList.Checked = taCustomerInfo.cusIsBlack.Equals("Y") ? true : false; txtNote.Text = taCustomerInfo.cusNote; } } }
private void btnEdit_Click(object sender, EventArgs e) { FrmTaCustomerInfo frmTaCustomerInfo = new FrmTaCustomerInfo(txtTelNum.Text.Trim()); if (isCid) { this.Close(); //frmTaCustomerInfo.ShowDialog(); if (frmTaCustomerInfo.ShowDialog() == DialogResult.OK) { taCust = frmTaCustomerInfo.CustomerInfo; } } else { if (frmTaCustomerInfo.ShowDialog() == DialogResult.OK) { if (!string.IsNullOrEmpty(frmTaCustomerInfo.strReadyTime)) { string[] sRt = frmTaCustomerInfo.strReadyTime.Split(':'); txtHour.Text = CommonDAL.SetAddZeroFront(sRt[0]); txtMinute.Text = CommonDAL.SetAddZeroFront(sRt[1]); } } SetUsrComePhoneAndIsNewUser(txtTelNum.Text.Trim()); } }
private void btnCollection_Click(object sender, EventArgs e) { if ((txtHour.Text.Length + txtMinute.Text.Length) < 4) { return; } strOrderType = PubComm.ORDER_TYPE_COLLECTION; taCust = GetCustInfo(txtTelNum.Text.Trim()); taCust.cusReadyTime = (!string.IsNullOrEmpty(txtHour.Text) && !string.IsNullOrEmpty(txtMinute.Text)) ? CommonDAL.SetAddZeroFront(txtHour.Text) + @":" + CommonDAL.SetAddZeroFront(txtMinute.Text) : " "; SetReadyTime(); DialogResult = DialogResult.OK; Close(); }
private void btnExit_Click(object sender, EventArgs e) { if (gvCompCustomer.RowCount < 1) { taCustomerInfo = null; } else { if (isClear) { taCustomerInfo = null; } else { if (string.IsNullOrEmpty(cusNum)) { taCustomerInfo = null; } else { taCustomerInfo.ID = Convert.ToInt32(gvCompCustomer.GetRowCellValue(gvCompCustomer.FocusedRowHandle, "ID") == null ? "0" : gvCompCustomer.GetRowCellValue(gvCompCustomer.FocusedRowHandle, "ID").ToString()); taCustomerInfo.cusPhone = gvCompCustomer.GetRowCellValue(gvCompCustomer.FocusedRowHandle, "cusPhone") == null ? "" : gvCompCustomer.GetRowCellValue(gvCompCustomer.FocusedRowHandle, "cusPhone").ToString(); taCustomerInfo.cusName = gvCompCustomer.GetRowCellValue(gvCompCustomer.FocusedRowHandle, "cusName") == null ? "" : gvCompCustomer.GetRowCellValue(gvCompCustomer.FocusedRowHandle, "cusName").ToString(); taCustomerInfo.cusHouseNo = gvCompCustomer.GetRowCellValue(gvCompCustomer.FocusedRowHandle, "cusHouseNo") == null ? "" : gvCompCustomer.GetRowCellValue(gvCompCustomer.FocusedRowHandle, "cusHouseNo").ToString(); taCustomerInfo.cusAddr = gvCompCustomer.GetRowCellValue(gvCompCustomer.FocusedRowHandle, "cusAddr") == null ? "" : gvCompCustomer.GetRowCellValue(gvCompCustomer.FocusedRowHandle, "cusAddr").ToString(); //taCustomerInfo.cusPostcode = gvCompCustomer.GetRowCellValue(gvCompCustomer.FocusedRowHandle, "cusPostcode") == null ? "" : gvCompCustomer.GetRowCellValue(gvCompCustomer.FocusedRowHandle, "cusPostcode").ToString(); taCustomerInfo.cusPostcode = txtPostcode.Text; taCustomerInfo.cusDistance = gvCompCustomer.GetRowCellValue(gvCompCustomer.FocusedRowHandle, "cusDistance") == null ? "" : gvCompCustomer.GetRowCellValue(gvCompCustomer.FocusedRowHandle, "cusDistance").ToString(); taCustomerInfo.cusPcZone = gvCompCustomer.GetRowCellValue(gvCompCustomer.FocusedRowHandle, "cusPcZone") == null ? "" : gvCompCustomer.GetRowCellValue(gvCompCustomer.FocusedRowHandle, "cusPcZone").ToString(); //taCustomerInfo.cusDelCharge = gvCompCustomer.GetRowCellValue(gvCompCustomer.FocusedRowHandle, "cusDelCharge") == null ? "" : gvCompCustomer.GetRowCellValue(gvCompCustomer.FocusedRowHandle, "cusDelCharge").ToString(); taCustomerInfo.cusDelCharge = txtDelCharge.Text; //taCustomerInfo.cusReadyTime = gvCompCustomer.GetRowCellValue(gvCompCustomer.FocusedRowHandle, "cusReadyTime") == null ? "" : gvCompCustomer.GetRowCellValue(gvCompCustomer.FocusedRowHandle, "cusReadyTime").ToString(); taCustomerInfo.cusReadyTime = txtReadyTime.Text; taCustomerInfo.cusIntNotes = gvCompCustomer.GetRowCellValue(gvCompCustomer.FocusedRowHandle, "cusIntNotes") == null ? "" : gvCompCustomer.GetRowCellValue(gvCompCustomer.FocusedRowHandle, "cusIntNotes").ToString(); taCustomerInfo.cusNotesOnBill = gvCompCustomer.GetRowCellValue(gvCompCustomer.FocusedRowHandle, "cusNotesOnBill") == null ? "" : gvCompCustomer.GetRowCellValue(gvCompCustomer.FocusedRowHandle, "cusNotesOnBill").ToString(); } } } this.DialogResult = DialogResult.OK; Close(); }
private void SetReadyTime() { if (!string.IsNullOrEmpty(txtTelNum.Text)) { //new SystemData().GetTaCustomer(); //TaCustomerInfo taCustomerInfo = new TaCustomerInfo(); //var lstCust = CommonData.TaCustomer.Where(s => s.cusPhone.Equals(txtTelNum.Text)); string strSqlWhere = ""; DynamicParameters dynamicParams = new DynamicParameters(); strSqlWhere = "cusPhone=@cusPhone"; dynamicParams.Add("cusPhone", txtTelNum.Text.Trim()); List <TaCustomerInfo> lstCust = new SQLiteDbHelper().QueryMultiByWhere <TaCustomerInfo>("Ta_Customer", strSqlWhere, dynamicParams); TaCustomerInfo taCustomerInfo = new TaCustomerInfo(); string strReadyTime = (!string.IsNullOrEmpty(txtHour.Text) && !string.IsNullOrEmpty(txtMinute.Text)) ? CommonDAL.SetAddZeroFront(txtHour.Text) + @":" + CommonDAL.SetAddZeroFront(txtMinute.Text) : " "; if (lstCust.Any()) { taCustomerInfo = lstCust.FirstOrDefault(); taCustomerInfo.cusReadyTime = strReadyTime; _control.UpdateEntity(taCustomerInfo); } else { taCustomerInfo.cusPhone = txtTelNum.Text.Trim(); taCustomerInfo.cusReadyTime = strReadyTime; _control.AddEntity(taCustomerInfo); } } }
private WbPrtTemplataTa GetAllPrtInfo() { WbPrtTemplataTa wbPrtTemplataTa = new WbPrtTemplataTa(); new SystemData().GetTaSysPrtSetGeneral(); var lstGen = CommonData.TaSysPrtSetGeneral; if (lstGen.Any()) { TaSysPrtSetGeneralInfo taSysPrtSetGeneralInfo = lstGen.FirstOrDefault(); //wbPrtTemplataTa.PrintAddress = taSysPrtSetGeneralInfo.IsPrtAddr; new SystemData().GetTaSysCtrl(); var lstTaSysCtrl = CommonData.TaSysCtrl; if (lstTaSysCtrl.Any()) { wbPrtTemplataTa.PrintAddress = lstTaSysCtrl.FirstOrDefault().ShopAddress; } wbPrtTemplataTa.PrintTel = taSysPrtSetGeneralInfo.TelNo; wbPrtTemplataTa.VATNo = taSysPrtSetGeneralInfo.VATNo; wbPrtTemplataTa.Msg1 = taSysPrtSetGeneralInfo.Msg1; wbPrtTemplataTa.Msg2 = taSysPrtSetGeneralInfo.Msg2; wbPrtTemplataTa.Msg3 = taSysPrtSetGeneralInfo.Msg3; wbPrtTemplataTa.Msg4 = taSysPrtSetGeneralInfo.Msg4; wbPrtTemplataTa.Msg5 = taSysPrtSetGeneralInfo.Msg5; } if (!string.IsNullOrEmpty(intCusID.ToString())) { new SystemData().GetTaCustomer(); var lstCust = CommonData.TaCustomer.Where(s => s.ID == intCusID); if (lstCust.Any()) { TaCustomerInfo taCustomerInfo = lstCust.FirstOrDefault(); wbPrtTemplataTa.CustName = taCustomerInfo.cusName; wbPrtTemplataTa.CustPhone = taCustomerInfo.cusPhone; wbPrtTemplataTa.CustDist = taCustomerInfo.cusDistance; wbPrtTemplataTa.CustMapRef = taCustomerInfo.cusPcZone; wbPrtTemplataTa.CustHouseNo = taCustomerInfo.cusHouseNo; wbPrtTemplataTa.CustAddr = taCustomerInfo.cusAddr; wbPrtTemplataTa.CustPostCode = taCustomerInfo.cusPostcode; wbPrtTemplataTa.ShopTime = taCustomerInfo.cusReadyTime; } } wbPrtTemplataTa.OrderDate = DateTime.Now.ToShortDateString(); wbPrtTemplataTa.OrderTime = DateTime.Now.ToShortTimeString(); wbPrtTemplataTa.Staff = string.IsNullOrEmpty(sStaff) ? CommonData.UsrBase.FirstOrDefault(s => s.ID == intStaffID).UsrName : sStaff; wbPrtTemplataTa.OrderNo = strChkOrder; wbPrtTemplataTa.ItemCount = sItemCount >= 1 ? sItemCount.ToString() : "0"; wbPrtTemplataTa.SubTotal = sSubTotal; wbPrtTemplataTa.Total = sTotalAmount; wbPrtTemplataTa.PayType = GetPayType(strChkOrder, deDay.Text); wbPrtTemplataTa.Tendered = sTendered; wbPrtTemplataTa.Change = string.IsNullOrEmpty(sChange) ? @"0.00" : (Convert.ToDecimal(sChange)).ToString("0.00"); wbPrtTemplataTa.OrderType = sOrderType; wbPrtTemplataTa.RefNo = sRefNo; wbPrtTemplataTa.DeliveryFee = sDeliveryFee; wbPrtTemplataTa.Discount = sDiscount; wbPrtTemplataTa.Surcharge = sSurcharge; #region VAT计算 if (CommonData.GenSet.Any()) { wbPrtTemplataTa.Rate1 = CommonData.GenSet.FirstOrDefault().VATPer + @"%"; //var lstVAT = from oi in CommonData.TaOrderItem.Where(s => s.CheckCode.Equals(strChkOrder) && s.BusDate.Equals(checkBusDate)) // join mi in CommonData.TaMenuItem on oi.ItemCode equals mi.MiDishCode // where !string.IsNullOrEmpty(mi.MiRmk) && mi.MiRmk.Contains(@"Without VAT") // select new // { // itemTotalPrice = oi.ItemTotalPrice // }; string strSqlWhere = ""; DynamicParameters dynamicParams = new DynamicParameters(); strSqlWhere = "CheckCode=@CheckCode AND BusDate=@BusDate"; dynamicParams.Add("CheckCode", strChkOrder); dynamicParams.Add("BusDate", checkBusDate); var lstOI = new SQLiteDbHelper().QueryMultiByWhere <TaOrderItemInfo>("Ta_OrderItem", strSqlWhere, dynamicParams); var lstVAT = from oi in lstOI join mi in CommonData.TaMenuItem on oi.ItemCode equals mi.MiDishCode where !string.IsNullOrEmpty(mi.MiRmk) && mi.MiRmk.Contains(@"Without VAT") select new { itemTotalPrice = oi.ItemTotalPrice }; decimal dTotal = 0; decimal dVatTmp = 0; decimal dVat = 0; if (lstVAT.Any()) { dTotal = lstVAT.ToList().Sum(vat => Convert.ToDecimal(vat.itemTotalPrice)); //交税 dVatTmp = (Convert.ToDecimal(CommonData.GenSet.FirstOrDefault().VATPer) / 100) * dTotal; dVat = Math.Round(dVatTmp, 2, MidpointRounding.AwayFromZero); } wbPrtTemplataTa.VatA = dVat.ToString(); //税前 wbPrtTemplataTa.Net1 = dTotal.ToString(); //总价 wbPrtTemplataTa.Gross1 = (dTotal - dVat).ToString(); wbPrtTemplataTa.Rate2 = "0.00%"; wbPrtTemplataTa.Net2 = (Convert.ToDecimal(sSubTotal) - dTotal).ToString(); wbPrtTemplataTa.VatB = "0.00"; wbPrtTemplataTa.Gross2 = (Convert.ToDecimal(sSubTotal) - dTotal).ToString(); } else { wbPrtTemplataTa.Rate1 = "0.00%"; wbPrtTemplataTa.Net1 = "0.00"; wbPrtTemplataTa.VatA = "0.00"; wbPrtTemplataTa.Gross1 = "0.00"; wbPrtTemplataTa.Rate2 = "0.00%"; wbPrtTemplataTa.Net2 = "0.00"; wbPrtTemplataTa.VatB = "0.00"; wbPrtTemplataTa.Gross2 = "0.00"; } #endregion return(wbPrtTemplataTa); }
private WbPrtTemplataTa GetAllPrtInfo(string strPrintType) { WbPrtTemplataTa wbPrtTemplataTa = new WbPrtTemplataTa(); //new SystemData().GetTaSysPrtSetGeneral(); TaSysPrtSetGeneralInfo taSysPrtSetGeneralInfo = CommonData.TaSysPrtSetGeneral.FirstOrDefault();; if (taSysPrtSetGeneralInfo != null) { //wbPrtTemplataTa.PrintAddress = taSysPrtSetGeneralInfo.IsPrtAddr; //new SystemData().GetTaSysCtrl(); var lstTaSysCtrl = CommonData.TaSysCtrl; if (lstTaSysCtrl.Any()) { wbPrtTemplataTa.PrintAddress = lstTaSysCtrl.FirstOrDefault().ShopAddress; } wbPrtTemplataTa.PrintTel = taSysPrtSetGeneralInfo.TelNo; wbPrtTemplataTa.VATNo = taSysPrtSetGeneralInfo.VATNo; wbPrtTemplataTa.Msg1 = taSysPrtSetGeneralInfo.Msg1; wbPrtTemplataTa.Msg2 = taSysPrtSetGeneralInfo.Msg2; wbPrtTemplataTa.Msg3 = taSysPrtSetGeneralInfo.Msg3; wbPrtTemplataTa.Msg4 = taSysPrtSetGeneralInfo.Msg4; wbPrtTemplataTa.Msg5 = taSysPrtSetGeneralInfo.Msg5; } if (!string.IsNullOrEmpty(callerID)) { //new SystemData().GetTaCustomer(); var lstCust = CommonData.TaCustomer.Where(s => s.ID.ToString().Equals(callerID)); if (lstCust.Any()) { TaCustomerInfo taCustomerInfo = lstCust.FirstOrDefault(); wbPrtTemplataTa.CustName = taCustomerInfo.cusName; wbPrtTemplataTa.CustPhone = taCustomerInfo.cusPhone; wbPrtTemplataTa.CustDist = taCustomerInfo.cusDistance; wbPrtTemplataTa.CustMapRef = taCustomerInfo.cusPcZone; wbPrtTemplataTa.CustHouseNo = taCustomerInfo.cusHouseNo; wbPrtTemplataTa.CustAddr = taCustomerInfo.cusAddr; wbPrtTemplataTa.CustPostCode = taCustomerInfo.cusPostcode; //wbPrtTemplataTa.ShopTime = taCustomerInfo.cusReadyTime; } } wbPrtTemplataTa.ShopTime = string.IsNullOrEmpty(txtReadyTime.Text) ? "ASAP" : txtReadyTime.Text; wbPrtTemplataTa.OrderDate = DateTime.Now.ToShortDateString(); wbPrtTemplataTa.OrderTime = DateTime.Now.ToShortTimeString(); wbPrtTemplataTa.Staff = htDetail["Staff"].ToString(); wbPrtTemplataTa.OrderNo = checkID; wbPrtTemplataTa.ItemCount = htDetail["ItemQty"].ToString(); wbPrtTemplataTa.SubTotal = htDetail["SubTotal"].ToString(); wbPrtTemplataTa.Total = txtToPay.Text; wbPrtTemplataTa.PayType = IsNotPaid ? @"NOT PAID" : CommonDAL.GetPayType(saveTaCheckOrderInfo); wbPrtTemplataTa.Tendered = txtTendered.Text; wbPrtTemplataTa.Change = string.IsNullOrEmpty(txtChange.Text) ? "0.00" : (Convert.ToDecimal(txtChange.Text)).ToString("0.00"); wbPrtTemplataTa.OrderType = orderType; wbPrtTemplataTa.RefNo = RefNum; wbPrtTemplataTa.DeliveryFee = @"0.00"; wbPrtTemplataTa.Discount = txtDiscount.Text; wbPrtTemplataTa.Surcharge = txtSurcharge.Text; #region VAT计算 if (strPrintType.Equals(WbPrtStatic.PRT_CLASS_ALL_AND_RECEIPT)) { GenSetInfo gsi = CommonData.GenSet.FirstOrDefault(); if (gsi != null) { var lstVAT = from oi in lstOrderItemInfos join mi in CommonData.TaMenuItem on oi.ItemCode equals mi.MiDishCode select new { VatInfo = mi.MiRmk, ItemTotalPrice = oi.ItemTotalPrice }; //new SystemData().GetOrderItemMatchVat(checkID, strBusDate); //var lstVAT = CommonData.GetOrderItemMatchVat; decimal dTotal = 0; decimal dVatTmp = 0; decimal dVat = 0; if (lstVAT.Any()) { //VAT1 wbPrtTemplataTa.Rate1 = gsi.VATPer + @"%"; dTotal = lstVAT.Where(s => !s.VatInfo.Contains("Without VAT")).ToList().Sum(vat => Convert.ToDecimal(vat.ItemTotalPrice)); //交税 dVatTmp = dTotal / ((100 + Convert.ToDecimal(gsi.VATPer)) / 100); dVat = Math.Round(dVatTmp, 2, MidpointRounding.AwayFromZero); // wbPrtTemplataTa.Net1 = dVat.ToString("0.00"); wbPrtTemplataTa.VatA = (dTotal - dVat).ToString("0.00"); wbPrtTemplataTa.Gross1 = dTotal.ToString("0.00"); //VAT2 dTotal = lstVAT.Where(s => s.VatInfo.Contains("Without VAT")).ToList().Sum(vat => Convert.ToDecimal(vat.ItemTotalPrice)); wbPrtTemplataTa.Rate2 = @"0.0%"; wbPrtTemplataTa.Net2 = dTotal.ToString("0.00"); wbPrtTemplataTa.VatB = @"0.00"; wbPrtTemplataTa.Gross2 = dTotal.ToString("0.00"); } } else { wbPrtTemplataTa.Rate1 = "0.00%"; wbPrtTemplataTa.Net1 = "0.00"; wbPrtTemplataTa.VatA = "0.00"; wbPrtTemplataTa.Gross1 = "0.00"; wbPrtTemplataTa.Rate2 = "0.00%"; wbPrtTemplataTa.Net2 = "0.00"; wbPrtTemplataTa.VatB = "0.00"; wbPrtTemplataTa.Gross2 = "0.00"; } } #endregion return(wbPrtTemplataTa); }
private void btnSave_Click(object sender, EventArgs e) { //清空模式下直接返回,不允许保存 if (isClear) { return; } #region 空判断 if (string.IsNullOrEmpty(txtPhone.Text)) { CommonTool.ShowMessage("Phone can not empty!"); return; } if (string.IsNullOrEmpty(txtName.Text)) { CommonTool.ShowMessage("Name can not empty!"); return; } if (string.IsNullOrEmpty(txtHouseNo.Text)) { CommonTool.ShowMessage("HouseNo. can not empty!"); return; } if (string.IsNullOrEmpty(txtAddress.Text)) { CommonTool.ShowMessage("Address can not empty!"); return; } if (string.IsNullOrEmpty(txtPostcode.Text)) { CommonTool.ShowMessage("Postcode can not empty!"); return; } if (string.IsNullOrEmpty(txtDistance.Text)) { CommonTool.ShowMessage("Distance can not empty!"); return; } if (string.IsNullOrEmpty(txtPcZone.Text)) { CommonTool.ShowMessage("PC Zone can not empty!"); return; } if (string.IsNullOrEmpty(txtDelCharge.Text)) { CommonTool.ShowMessage("Del Charge can not empty!"); return; } //if (string.IsNullOrEmpty(txtReadyTime.Text)) //{ // CommonTool.ShowMessage("Ready Time can not empty!"); // return; //} //if (string.IsNullOrEmpty(txtIntNotes.Text)) //{ // CommonTool.ShowMessage("Int Notes can not empty!"); // return; //} //if (string.IsNullOrEmpty(txtNotesOnBill.Text)) //{ // CommonTool.ShowMessage("Notes On Bill can not empty!"); // return; //} #endregion TaCustomerInfo taCustomerInfo = new TaCustomerInfo(); cusNum = taCustomerInfo.cusPhone = txtPhone.Text; taCustomerInfo.cusName = txtName.Text; taCustomerInfo.cusHouseNo = txtHouseNo.Text; taCustomerInfo.cusAddr = txtAddress.Text; //taCustomerInfo.cusPostcode = luePostcode.Text; taCustomerInfo.cusPostcode = txtPostcode.Text; taCustomerInfo.cusDistance = txtDistance.Text; taCustomerInfo.cusPcZone = txtPcZone.Text; //taCustomerInfo.cusDelCharge = (CommonDAL.GetDeliveryFee(txtDistance.Text, "0.00")).ToString("0.00"); taCustomerInfo.cusDelCharge = txtDelCharge.Text; taCustomerInfo.cusReadyTime = txtReadyTime.Text; taCustomerInfo.cusIntNotes = txtIntNotes.Text; taCustomerInfo.cusNotesOnBill = txtNotesOnBill.Text; taCustomerInfo.cusIsBlack = chkBlackListed.Checked ? "Y" : "N"; try { if (!IsExitCustInfo(taCustomerInfo.cusPhone)) { _control.AddEntity(taCustomerInfo); } else { taCustomerInfo.ID = Convert.ToInt32(gvCompCustomer.GetRowCellValue(gvCompCustomer.FocusedRowHandle, "ID")); _control.UpdateEntity(taCustomerInfo); } } catch (Exception ex) { LogHelper.Error(this.Name, ex); } gridControlPostcode.Visible = false; BindData("", "", ""); //isAdd = false; isClear = false; sReadyTime = txtReadyTime.Text; CommonTool.ShowMessage("Save successful!"); }
private WbPrtTemplataTa GetAllPrtInfo() { WbPrtTemplataTa wbPrtTemplataTa = new WbPrtTemplataTa(); new SystemData().GetTaSysPrtSetGeneral(); var lstGen = CommonData.TaSysPrtSetGeneral; if (lstGen.Any()) { TaSysPrtSetGeneralInfo taSysPrtSetGeneralInfo = lstGen.FirstOrDefault(); //wbPrtTemplataTa.PrintAddress = taSysPrtSetGeneralInfo.IsPrtAddr; new SystemData().GetTaSysCtrl(); var lstTaSysCtrl = CommonData.TaSysCtrl; if (lstTaSysCtrl.Any()) { wbPrtTemplataTa.PrintAddress = lstTaSysCtrl.FirstOrDefault().ShopAddress; } wbPrtTemplataTa.PrintTel = taSysPrtSetGeneralInfo.TelNo; wbPrtTemplataTa.VATNo = taSysPrtSetGeneralInfo.VATNo; wbPrtTemplataTa.Msg1 = taSysPrtSetGeneralInfo.Msg1; wbPrtTemplataTa.Msg2 = taSysPrtSetGeneralInfo.Msg2; wbPrtTemplataTa.Msg3 = taSysPrtSetGeneralInfo.Msg3; wbPrtTemplataTa.Msg4 = taSysPrtSetGeneralInfo.Msg4; wbPrtTemplataTa.Msg5 = taSysPrtSetGeneralInfo.Msg5; } if (!string.IsNullOrEmpty(intCusID.ToString())) { //new SystemData().GetTaCustomer(); var lstCust = CommonData.TaCustomer.Where(s => s.ID == intCusID); if (lstCust.Any()) { TaCustomerInfo taCustomerInfo = lstCust.FirstOrDefault(); wbPrtTemplataTa.CustName = taCustomerInfo.cusName; wbPrtTemplataTa.CustPhone = taCustomerInfo.cusPhone; wbPrtTemplataTa.CustDist = taCustomerInfo.cusDistance; wbPrtTemplataTa.CustMapRef = taCustomerInfo.cusPcZone; wbPrtTemplataTa.CustHouseNo = taCustomerInfo.cusHouseNo; wbPrtTemplataTa.CustAddr = taCustomerInfo.cusAddr; wbPrtTemplataTa.CustPostCode = taCustomerInfo.cusPostcode; wbPrtTemplataTa.ShopTime = taCustomerInfo.cusReadyTime; } } wbPrtTemplataTa.OrderDate = DateTime.Now.ToShortDateString(); wbPrtTemplataTa.OrderTime = DateTime.Now.ToShortTimeString(); wbPrtTemplataTa.Staff = sStaff; wbPrtTemplataTa.OrderNo = strChkOrder; wbPrtTemplataTa.ItemCount = sItemCount >= 1 ? sItemCount.ToString() : "0"; wbPrtTemplataTa.SubTotal = sSubTotal; wbPrtTemplataTa.Total = sTotalAmount; wbPrtTemplataTa.PayType = sPayType; wbPrtTemplataTa.Tendered = sTendered; wbPrtTemplataTa.Change = string.IsNullOrEmpty(sChange) ? @"0.00" : (Convert.ToDecimal(sChange)).ToString("0.00"); wbPrtTemplataTa.OrderType = sOrderType; wbPrtTemplataTa.RefNo = sRefNo; wbPrtTemplataTa.DeliveryFee = sDeliveryFee; wbPrtTemplataTa.Discount = sDiscount; wbPrtTemplataTa.Surcharge = sSurcharge; return(wbPrtTemplataTa); }
private void btnExit_Click(object sender, EventArgs e) { taCust = null; DialogResult = DialogResult.OK; Close(); }