/// <summary> /// Create a new tinprequestpaydtl object. /// </summary> /// <param name="shippingsysid">Initial value of the shippingsysid property.</param> /// <param name="itemname">Initial value of the itemname property.</param> public static tinprequestpaydtl Createtinprequestpaydtl(global::System.String shippingsysid, global::System.String itemname) { tinprequestpaydtl tinprequestpaydtl = new tinprequestpaydtl(); tinprequestpaydtl.shippingsysid = shippingsysid; tinprequestpaydtl.itemname = itemname; return tinprequestpaydtl; }
private void doPrint() { try { #region Check Input foreach (UltraGridRow row in this.grdDetail.Rows) { if (row.Cells["itemname"].Value.ToString().Equals("")) { throw new Exception(UtilCulture.GetString("Msg.R01020", UtilCulture.GetString("Label.R0104401"))); } if (Convert.ToInt16(row.Cells["qty"].Value) <= 0) { throw new Exception(UtilCulture.GetString("Msg.R01016", UtilCulture.GetString("Label.R0104403"))); } } #endregion #region Save Input tinprequestpay requestPay = new tinprequestpay(); requestPay.shippingsysid = ShipingSysId; requestPay.rptdate = rptDate; requestPay.currency = ((ValueInfo)this.cmbCurrency.SelectedItem).ValueField; requestPay.template = ((ValueInfo)this.cmbTemplate.SelectedItem).ValueField; List<tinprequestpaydtl> lstRequestPayDtl = new List<tinprequestpaydtl>(); foreach (UltraGridRow row in this.grdDetail.Rows) { tinprequestpaydtl requestpaydtl = new tinprequestpaydtl(); requestpaydtl.shippingsysid = ShipingSysId; requestpaydtl.itemname = row.Cells["itemname"].Value.ToString(); requestpaydtl.currency = row.Cells["currency"].Value.ToString(); requestpaydtl.unit = row.Cells["unit"].Value.ToString(); requestpaydtl.price = Convert.ToDecimal(row.Cells["price"].Value); requestpaydtl.qty = Convert.ToDecimal(row.Cells["qty"].Value); lstRequestPayDtl.Add(requestpaydtl); } DoInsertRequestPay(requestPay, lstRequestPayDtl); #endregion #region Get Data DataTable pricingDt = GetValidPricing(customerId, rptDate); DataTable iqcDt = GetValidIQC(customerId); DataTable exDt = GetValidExchange(rptDate); string currency = ((ValueInfo)this.cmbCurrency.SelectedItem).ValueField.Trim(); #endregion #region Check Shipping var qByStyleNo=from p in dtlDt.AsEnumerable() group p by new { styleno = p["styleno"].ToString(), checktype = p["checktype"].ToString() } into g select new { g.Key.styleno, g.Key.checktype }; foreach (var data in qByStyleNo) { var iqcckq=from p in iqcDt.AsEnumerable() where p["styleno"].ToString().Equals(data.styleno.ToString()) && p["customerid"].ToString().Equals(customerId) select p; //Check IQC if (iqcckq.Count() == 0) { throw new Exception(UtilCulture.GetString("Msg.R01028", data.styleno.ToString())); } else { string shoeCategory = iqcckq.ElementAt(0)["category"].ToString(); Double bootHeight = Convert.ToDouble(iqcckq.ElementAt(0)["bootheight"]); //Check Pricing var pricingckq = from p in pricingDt.AsEnumerable() where p["category"].ToString().Equals(shoeCategory) && Convert.ToDouble(p["sbootheight"]) <= bootHeight && Convert.ToDouble(p["ebootheight"]) >= bootHeight && p["checktype"].ToString().Equals(data.checktype) select p; if (pricingckq.Count() == 0) { throw new Exception(UtilCulture.GetString("Msg.R01029", shoeCategory + "," + bootHeight + "," + data.checktype)); } else { //Check Exchange if (!pricingckq.ElementAt(0)["currency"].ToString().Trim().Equals(currency)) { var exckq = from p in exDt.AsEnumerable() where p["fromcurrency"].ToString().Equals(pricingckq.ElementAt(0)["currency"].ToString()) && p["tocurrency"].ToString().Equals(currency) select p; if (exckq.Count() == 0) { throw new Exception(UtilCulture.GetString("Msg.R01030", pricingckq.ElementAt(0)["currency"].ToString() + "->" + bootHeight + "," + currency)); } } } if (data.checktype.Equals("IX")) { var pricingckiq = from p in pricingDt.AsEnumerable() where p["category"].ToString().Equals(shoeCategory) && Convert.ToDouble(p["sbootheight"]) <= bootHeight && Convert.ToDouble(p["ebootheight"]) >= bootHeight && p["checktype"].ToString().Equals("I") select p; if (pricingckiq.Count() == 0) { throw new Exception(UtilCulture.GetString("Msg.R01029", shoeCategory + "," + bootHeight + ",I")); } else { //Check Exchange if (!pricingckiq.ElementAt(0)["currency"].ToString().Trim().Equals(currency)) { var exckq = from p in exDt.AsEnumerable() where p["fromcurrency"].ToString().Equals(pricingckiq.ElementAt(0)["currency"].ToString()) && p["tocurrency"].ToString().Equals(currency) select p; if (exckq.Count() == 0) { throw new Exception(UtilCulture.GetString("Msg.R01030", pricingckiq.ElementAt(0)["currency"].ToString() + "->" + currency)); } } } } } } #endregion #region Check Other Pricing has exchange rate foreach (tinprequestpaydtl requestpaydtl in lstRequestPayDtl) { //Check Exchange if (!requestpaydtl.currency.Trim().Equals(currency)) { var exckq = from p in exDt.AsEnumerable() where p["fromcurrency"].ToString().Equals(requestpaydtl.currency) && p["tocurrency"].ToString().Equals(currency) select p; if (exckq.Count() == 0) { throw new Exception(UtilCulture.GetString("Msg.R01030", requestpaydtl.currency + "->" + currency)); } } } #endregion WaitingForm.CreateWaitForm(); WaitingForm.SetWaitMessage("正在生成请款单,请稍候..."); (new ExcelExport()).ExportRequestPay(((ValueInfo)this.cmbTemplate.SelectedItem).ValueField,rptDate, currency, GetSingleShipping(ShipingSysId), GetShippingOrigDtlForReport(ShipingSysId), GetPackingRecRetrieve(ShipingSysId), iqcDt, pricingDt, exDt, lstRequestPayDtl); WaitingForm.CloseWaitForm(); } catch (Exception ex) { baseForm.CreateMessageBox(Public_MessageBox.Error, MessageBoxButtons.OK, null, ex.Message); } }
/// <summary> /// Deprecated Method for adding a new object to the tinprequestpaydtl EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTotinprequestpaydtl(tinprequestpaydtl tinprequestpaydtl) { base.AddObject("tinprequestpaydtl", tinprequestpaydtl); }