public void Reports_AddTo2020_Product(string input, long expected) { Customs c = new Customs(input); long sum = c.SumOfQsEveryoneAnswered(); Assert.Equal(expected, sum); }
/// <summary> /// 本示例介绍如何进行海关报关 /// </summary> public static void Example(string appId, string chId) { var cuParams = new Dictionary <string, object> { { "app", appId }, { "charge", chId }, { "channel", "upacp_pc" }, { "trade_no", new Random().Next(1, 999999999).ToString() }, { "customs_code", "GUANGZHOU" }, { "amount", 1 }, { "is_split", true }, { "sub_order_no", new Random().Next(1, 999999).ToString() }, { "extra", new Dictionary <string, object> { { "pay_account", "123456" }, { "certif_type", "02" }, { "customer_name", "customer name" }, { "certif_id", "62148502" }, { "tax_amount", 10 } } } }; Console.WriteLine("****发起海关报关请求****"); var cu = Customs.Create(cuParams); Console.WriteLine(cu); Console.WriteLine(); Console.WriteLine("****查询海关报关对象****"); Console.WriteLine(Customs.Retrieve(cu.Id)); Console.WriteLine(); }
public DeliveryFee(ExpressType type, NormalFeeMethod normal, CustomFeeMethod[] customs) : this(type, normal) { TkDebug.AssertArgumentNull(normal, "normal", null); TkDebug.AssertArgumentNull(customs, "customs", null); Customs.AddRange(customs); }
public void ShowOutWareOrderWindow(int customId) { var custom = Customs.FirstOrDefault(_ => _.Id == customId); WishCustomOutOrder show = new WishCustomOutOrder(custom); Window onwer = Window.GetWindow(this); show.Owner = onwer; show.ShowDialog(); }
public static void Main() { var input = System.IO.File.ReadAllText("input.txt"); var customs = input.Split("\n\n"); var sumAny = Customs.SumAny(customs); var sumAll = Customs.SumAll(customs); System.Console.WriteLine(sumAny); System.Console.WriteLine(sumAll); }
public void SumAny_Works() { // arrange // act var result = Customs.SumAny(_customs); // assert Assert.Equal(11, result); }
public void CountAnyAnswers_Works() { // arrange var custom = "abcx\nabcy\nabcz"; // act var result = Customs.CountAnyAnswers(custom); // assert Assert.Equal(6, result); }
private void fillCusromDetails(int CustomerId, int CustomId, int ProductTypeId) { Customs custom = new Customs(); string locPics = ""; custom.ProductTypeId = ProductTypeId; custom.CustomerId = CustomerId; custom.Id = CustomId; custom = CustomBLL.Instance.GetCustomDetail(custom); if (custom != null) { locPics = Convert.ToString(custom.CustomerLocationPics.Count); if (locPics != "") { hidCount.Value = Convert.ToString(custom.CustomerLocationPics.Count); } hidProdId.Value = custom.Id.ToString(); txtCustomer.Text = custom.Customer; txtProposalCost.Text = custom.ProposalCost.ToString(); txtProposalTerm.Text = custom.ProposalTerms; txtspecialIns.Text = custom.SpecialInstruction; txtworkarea.Text = custom.WorkArea; txtCustSupMaterial.Text = custom.CustSuppliedMaterial; if (custom.CustSuppliedMaterial == "") { drpMaterial.SelectedItem.Text = "Select"; } else { drpMaterial.SelectedItem.Text = custom.CustSuppliedMaterial; } chkCustSupMaterial.Checked = custom.IsCustSupMatApplicable; txtStorage.Text = custom.MaterialStorage; if (custom.MaterialStorage == "") { drpStorage.SelectedItem.Text = "Select"; } else { drpStorage.SelectedItem.Text = custom.MaterialStorage; } chkStorage.Checked = custom.IsMatStorageApplicable; chkPermit.Checked = custom.IsPermitRequired; chkHabitat.Checked = custom.IsHabitat; lnkDownload.Text = custom.Attachment; ViewState[SessionKey.Key.PagedataTable.ToString()] = custom.CustomerLocationPics; gvCategory1.DataSource = custom.CustomerLocationPics; gvCategory1.DataBind(); } }
public Report_bscc(Customs.Entity.Store_out_headInfo CurOutHead, List<Customs.Entity.Store_out_listInfo> list, int PageIndex, int PageSize, bool LastPage, int FirstPage, string Title) { InitializeComponent(); //初始化表头 try { #region 表头部分 //初始化表头部分 if (Title == "监管") { labTitle.Text = "出 口 监 管 仓 货 物"; } if (Title == "保税" || Title == "MCC") { labTitle.Text = "进 口 保 税 仓 货 物"; } labPage.Text = "第 " + (PageIndex + 1).ToString() + " 续页"; labCustom.Text = CurOutHead.Ie_port; if (CurOutHead.Ie_date.ToString("yyyy-MM-dd") != "1900-01-01") { labDate.Text = CurOutHead.Ie_date.ToString("yyyy-MM-dd"); } lbcust_bill_id.Text = CurOutHead.Cust_bill_id; lbBill_id.Text = CurOutHead.Bill_id; #endregion #region 明细项 if (!LastPage) { for (int i = 1; i <= PageSize; i++) { int j = i + PageIndex * PageSize + FirstPage - 1; init(list, i, j); } } else { for (int i = 1; i <= list.Count - FirstPage - PageIndex * PageSize; i++) { int j = i + PageIndex * PageSize + FirstPage - 1; init(list, i, j); } } #endregion } catch (Exception) { throw; } }
public ActionResult Delete([DataSourceRequest] DataSourceRequest request, Customs model) { if (model != null && ModelState.IsValid) { IRestResponse WSR = Task.Run(() => apiClient.postObject("Aduana/Eliminar", model)).Result; if (WSR.StatusCode != HttpStatusCode.OK) { ModelState.AddModelError("errorGeneral", JObject.Parse(WSR.Content).ToObject <Error>().Message.ToString()); } } return(Json(new[] { model }.ToDataSourceResult(request, ModelState))); }
public ActionResult Update([DataSourceRequest] DataSourceRequest request, Customs model) { if (model != null && ModelState.IsValid) { model.RegisterUser = ((Commons.User)Session["USERINFO"]).UserName; IRestResponse WSR = Task.Run(() => apiClient.postObject("Aduana/Modificar", model)).Result; if (WSR.StatusCode != HttpStatusCode.OK) { ModelState.AddModelError("errorGeneral", JObject.Parse(WSR.Content).ToObject <Error>().Message.ToString()); } } return(Json(new[] { model }.ToDataSourceResult(request, ModelState))); }
public Rpt_Customs_InWarehouseBil(Customs.Entity.Store_in_headInfo Store_in_head, DataTable Store_in_lists, DataTable dtbSPBCODES, DataTable dtbEnterprise001, DataTable dtbInType001,DataTable c_complexys) { InitializeComponent(); this._Store_in_head = Store_in_head; this._Store_in_lists = Store_in_lists; this._dtbSPBCODES = dtbSPBCODES; this._dtbEnterprise001 = dtbEnterprise001; this._dtbInType001 = dtbInType001; DetailReport.DataSource = Store_in_lists; _c_complexys = c_complexys; }
public Report_ExSupEx(Customs.Entity.Store_in_headInfo CurInHead, List<Customs.Entity.Store_in_listInfo> list, int PageIndex, int PageSize, bool LastPage, int FirstPage, string Title) { InitializeComponent(); try { //初始化表头部分 if (Title == "OutJG") { labTitle.Text = "出 口 监 管 仓 货 物"; } if (Title == "inBS") { labTitle.Text = "进 口 保 税 仓 货 物"; } labPage.Text = "第 " + (PageIndex + 1).ToString() + " 续页"; labWareNO.Text = CurInHead.Bill_id; //目的海关 lbCust_bill_id.Text = CurInHead.Cust_bill_id; labCustom.Text = CurInHead.Ie_portName; tbRemark.Text = CurInHead.Remark; labDate.Text = CurInHead.Ie_date.ToString("yyyy-MM-dd") != "1900-01-01" ? CurInHead.Ie_date.ToString("yyyy-MM-dd") : ""; if (!LastPage) { for (int i = 1; i <= PageSize; i++) { int j = i + PageIndex * PageSize + FirstPage - 1; init(list, i, j); } } else { for (int i = 1; i <= list.Count - FirstPage - PageIndex * PageSize; i++) { int j = i + PageIndex * PageSize + FirstPage - 1; init(list, i, j); } } } catch (Exception) { throw; } }
/// <summary> /// /// </summary> public void Dispose() { if (IsDisposed) { return; } foreach (var pair in Customs) { pair.Value.Dispose(); } Customs.Clear(); Customs = null; Device = null; IsDisposed = true; }
public ReadOnlyMemory <IConsumerPipe <T> > BuildPipeline() { var pipeline = new List <IConsumerPipe <T> > { new CancellerConsumerPipe <T>() }; if (MessageAcknowledgmentPipeBuilder != null) { pipeline.Add(MessageAcknowledgmentPipeBuilder.Build()); } if (LogDelegate != null) { pipeline.Add(new LogExceptionConsumerPipe <T>(LogDelegate)); } pipeline.Add(new DeserializerConsumerPipe <T>(Deserialization)); pipeline.AddRange(Customs.Select(builder => builder.Build())); pipeline.Add(new MessageProcessorPipe <T>()); return(pipeline.ToArray()); }
/// <summary> /// 出库 /// </summary> /// <param name="customId"></param> public void CheckOutWare(int customId) { ShowCustomList = false; Rfids.Clear(); TotalCount = Rfids.Count; UserContext.RfidReadProvider.OnDataReceived += RfidReadProvider_OnDataReceived; SelectedCustom = CustomSource.FirstOrDefault(_ => _.Id == customId); WareOutDetailSource = new ObservableCollection <WareOutDetailVM>(); var custom = Customs.Find(_ => _.Id == customId); if (custom == null) { return; } int index = 1; foreach (var wareInfo in custom.WareInfos) { WareOutDetailSource.Add(new WareOutDetailVM() { Index = index++, WareTypeId = wareInfo.WareTypeId, WareTypeName = wareInfo.WareTypeName, Capacity = wareInfo.Capacity, Stock = wareInfo.Stock, MaxCount = wareInfo.Capacity - wareInfo.Stock }); } }
public bool AddCustom(Customs custom) { return(CustomDAL.Instance.AddCustom(custom)); }
//public bool DeleteCustomMaterialList(int vendorCategory, string jobid) //{ // return CustomDAL.Instance.DeleteCustomMaterialList(vendorCategory, jobid); //} public Customs GetCustomDetail(Customs custom) { return(custom = CustomDAL.Instance.GetCustomDetail(custom)); }
public Report_ckjgcc(Customs.Entity.Store_out_headInfo CurOutHead, List<Customs.Entity.Store_out_listInfo> CurOutList, string Type) { InitializeComponent(); //Type = "保税"; try { #region 表头项 if (Type == "监管") { tbWareName.Text = "华南物流监管仓"; tbVar.Text = "集装箱号"; tbTitle.Text = "出 口 监 管 仓 货 物"; labCustomCode.Text = CurOutHead.Bill_id; //labWareNO.Text = CurOutHead.Store_code; //tbSum.Visible = false; } if (Type == "保税" || Type == "MCC") { xrPictureBox1.Visible = false; labCustomCode.Visible = false; xrLabel3.Visible = false; tbTitle.Text = "进 口 保 税 仓 货 物"; tbWareName.Text = "华南物流保税仓"; tbVar.Text = "载货清单号"; xrLabel2.Text = "出仓单编号:"; //labWareNO.Text = CurOutHead.Bill_id; } //总的件数合计 BarCode.Text = CurOutHead.Bill_id; lbJZXH.Text = CurOutHead.Cntnr_spec; labWareNO.Text = CurOutHead.Cust_bill_id; lbCnsNo.Text = CurOutHead.Cns_no; tbTotalPkgs.Text = CurOutHead.Pkgs_num.ToString(); tbreferdoc.Text = CurOutHead.Refer_doc; tbLoadCarCode.Text = CurOutHead.Shipping_no; tbdeliverUnit.Text = htCustom[ CurOutHead.Lease_holder]!=null?htCustom[ CurOutHead.Lease_holder].ToString():""; tbOut.Text = CurOutHead.Ie_port; tbFZCode.Text = CurOutHead.Seal_no; //司机本海关编号 tbcarCcode.Text = CurOutHead.Driver_no; tbOutCountry.Text = CommonReport.GetCode("102", CurOutHead.Trade_coun, false); tbCarNO.Text = CurOutHead.Car_no; tbOutType.Text = CurOutHead.Out_type; lbRemark.Text = CurOutHead.Remark; if (CurOutHead.Ie_date.ToString("yyyy-MM-dd") != "1900-01-01") { labDate.Text = CurOutHead.Ie_date.ToString("yyyy-MM-dd"); } //labCustom.Text = CurOutHead.Ie_port; tbTotal.Text = CurOutHead.All_value.ToString(); tbTotalW.Text = "毛重:" + CurOutHead.Gross_wt.ToString() + "\n" + "净重:" + CurOutHead.Net_wt.ToString(); #endregion #region 明细项 if (CurOutList.Count <= 5) { for (int i = 1; i <= CurOutList.Count; i++) { init(i, CurOutList); } } if (CurOutList.Count > 5) { for (int i = 1; i <= 5; i++) { init(i, CurOutList); } } #endregion } catch (Exception) { throw; } }
//初始化出口监管仓货物入仓清单 public Report_ExSup(Customs.Entity.Store_in_headInfo CurInHead, List<Customs.Entity.Store_in_listInfo> list) { //先初始化界面 InitializeComponent(); //初始化报表 try { //初始化表头部分 //仓库编号 labWareNO.Text = CurInHead.Cust_bill_id; labCustomCode.Text = CurInHead.Bill_id; lbCnsNo.Text = CurInHead.Cns_no; tbWareName.Text = "深国际华南物流监管仓"; tbreferdoc.Text = CurInHead.Refer_doc; //发货单位 tbdeliverUnit.Text = CommonReport.GetCompanyName(CurInHead.Rs_code); tbSumWeight.Text = "毛重:" + CurInHead.Gross_wt.ToString() + "\n" + "净重:" + CurInHead.Net_wt.ToString();//CurInHead.Gross_wt.ToString(); lbPkgs.Text = "共 " + CurInHead.Pkgs_num + " 件"; tbtotalValue.Text = CurInHead.All_value.ToString(); tbPlace.Text = CurInHead.Place; //国别 tbOutCountry.Text = list != null ? CommonReport.GetCode("102", list[0].Orign_coun, false) : ""; //WareCommon.GetCode("102", CurInHead.Trade_coun, false); tbtaxRebate.Text = CurInHead.Tax_flag.Trim() == "1" ? "是" : "否"; tbTradetype.Text = httrade_way.Contains(CurInHead.Trade_mode) ? httrade_way[CurInHead.Trade_mode].ToString() : ""; tbInWaretype.Text = htIn_type.Contains(CurInHead.In_type) ? htIn_type[CurInHead.In_type].ToString() : ""; //目的海关 labCustom.Text = CurInHead.Ie_portName; //报关员 //labName.Text = "报关员"; //货主 //lab.Text = "龙卓公司"; //仓库员 //labAdmin.Text = "胡藩"; BarCode.Text = CurInHead.Bill_id; tbremark.Text = CurInHead.Remark; labDate.Text = CurInHead.Ie_date.ToString("yyyy-MM-dd") != "1900-01-01" ? CurInHead.Ie_date.ToString("yyyy-MM-dd") : ""; //txtPkgs.Text = "200件"; if (list.Count <= 5) { for (int i = 1; i <= list.Count; i++) { #region 给table赋值 DevExpress.XtraReports.UI.XRTableCell seq = (DevExpress.XtraReports.UI.XRTableCell)Detail.FindControl("cseq" + i, false); seq.Text = list[i - 1].G_no.ToString(); DevExpress.XtraReports.UI.XRTableCell cCode = (DevExpress.XtraReports.UI.XRTableCell)Detail.FindControl("cCode" + i, false); cCode.Text = list[i - 1].Code_t; //货物名称和规格 DevExpress.XtraReports.UI.XRTableCell cName = (DevExpress.XtraReports.UI.XRTableCell)Detail.FindControl("cName" + i, false); cName.Text = list[i - 1].Mg_name + "\r\n" + list[i - 1].Mg_spec + "\n" + list[i - 1].Pkgs.ToString() + "件"; //数量 string temp = PublicMethod.RemoveZero(list[i-1].Qty_2.ToString()) == "0" ? "" : PublicMethod.RemoveZero(list[i-1].Qty_2.ToString()); DevExpress.XtraReports.UI.XRTableCell cNum = (DevExpress.XtraReports.UI.XRTableCell)Detail.FindControl("cNum" + i, false); //cNum.Text = PublicMethod.RemoveZero(list[i - 1].G_qty.ToString()) + "\n" + PublicMethod.RemoveZero(list[i - 1].Qty_1.ToString()) + "\n" + temp; cNum.Text = PublicMethod.RemoveZero(list[i - 1].Qty_1.ToString()) + "\n" + temp + "\n" + PublicMethod.RemoveZero(list[i - 1].G_qty.ToString()); //list[i - 1].G_qty.ToString(); //单位 DevExpress.XtraReports.UI.XRTableCell cUnit = (DevExpress.XtraReports.UI.XRTableCell)Detail.FindControl("cUnit" + i, false); //cUnit.Text = PublicMethod.GetHashValue(ht,list[i - 1].G_unit).ToString() + "\n" + PublicMethod.GetHashValue(ht,list[i - 1].Unit_code1).ToString() + "\n" + PublicMethod.GetHashValue(ht,list[i - 1].Unit_code2).ToString(); cUnit.Text = CommonReport.GetHashValue(ht, list[i - 1].Unit_code1).ToString() + "\n" + CommonReport.GetHashValue(ht, list[i - 1].Unit_code2).ToString() + "\n" + CommonReport.GetHashValue(ht, list[i - 1].G_unit).ToString(); //ht.Contains(list[i - 1].G_unit) ? ht[list[i - 1].G_unit].ToString() : "";//list[i - 1].G_unit; DevExpress.XtraReports.UI.XRTableCell cWeight = (DevExpress.XtraReports.UI.XRTableCell)Detail.FindControl("cWeight" + i, false); cWeight.Text = list[i - 1].Gross + "\r\n" + list[i - 1].Net; //币值 DevExpress.XtraReports.UI.XRTableCell cCoin = (DevExpress.XtraReports.UI.XRTableCell)Detail.FindControl("cCoin" + i, false); cCoin.Text = CommonReport.GetCode("118", list[i - 1].Curr_code.ToString(), true); DevExpress.XtraReports.UI.XRTableCell cPrice = (DevExpress.XtraReports.UI.XRTableCell)Detail.FindControl("cPrice" + i, false); cPrice.Text = list[i - 1].Unit_price.ToString(); DevExpress.XtraReports.UI.XRTableCell cTotal = (DevExpress.XtraReports.UI.XRTableCell)Detail.FindControl("cTotal" + i, false); cTotal.Text = list[i - 1].Trade_ttl.ToString(); #endregion } } if (list.Count > 5) { for (int i = 1; i <= 5; i++) { #region 给table赋值 DevExpress.XtraReports.UI.XRTableCell seq = (DevExpress.XtraReports.UI.XRTableCell)Detail.FindControl("cseq" + i, false); seq.Text = list[i - 1].G_no.ToString(); DevExpress.XtraReports.UI.XRTableCell cCode = (DevExpress.XtraReports.UI.XRTableCell)Detail.FindControl("cCode" + i, false); cCode.Text = list[i - 1].Code_t; //货物名称和规格 DevExpress.XtraReports.UI.XRTableCell cName = (DevExpress.XtraReports.UI.XRTableCell)Detail.FindControl("cName" + i, false); cName.Text = list[i - 1].Mg_name + "\r\n" + list[i - 1].Mg_spec + "\r\n" + list[i - 1].Pkgs.ToString() + "件"; //数量 string temp = PublicMethod.RemoveZero(list[i-1].Qty_2.ToString())=="0"?"":PublicMethod.RemoveZero( list[i-1].Qty_2.ToString()); DevExpress.XtraReports.UI.XRTableCell cNum = (DevExpress.XtraReports.UI.XRTableCell)Detail.FindControl("cNum" + i, false); //cNum.Text = PublicMethod.RemoveZero(list[i - 1].G_qty.ToString()) + "\n" + PublicMethod.RemoveZero(list[i - 1].Qty_1.ToString()) + "\n" + temp; //list[i - 1].G_qty.ToString(); cNum.Text = PublicMethod.RemoveZero(list[i - 1].Qty_1.ToString()) + "\n" + temp + "\n" + PublicMethod.RemoveZero(list[i - 1].G_qty.ToString()); //list[i - 1].G_qty.ToString(); //单位 DevExpress.XtraReports.UI.XRTableCell cUnit = (DevExpress.XtraReports.UI.XRTableCell)Detail.FindControl("cUnit" + i, false); //cUnit.Text = PublicMethod.GetHashValue(ht,list[i - 1].G_unit).ToString() + "\n" + PublicMethod.GetHashValue(ht,list[i - 1].Unit_code1).ToString() + "\n" + PublicMethod.GetHashValue(ht,list[i - 1].Unit_code2).ToString(); //ht.Contains(list[i - 1].G_unit) ? ht[list[i - 1].G_unit].ToString() : "";//list[i - 1].G_unit; cUnit.Text = CommonReport.GetHashValue(ht, list[i - 1].Unit_code1).ToString() + "\n" + CommonReport.GetHashValue(ht, list[i - 1].Unit_code2).ToString() + "\n" + CommonReport.GetHashValue(ht, list[i - 1].G_unit).ToString(); //ht.Contains(list[i - 1].G_unit) ? ht[list[i - 1].G_unit].ToString() : "";//list[i - 1].G_unit; DevExpress.XtraReports.UI.XRTableCell cWeight = (DevExpress.XtraReports.UI.XRTableCell)Detail.FindControl("cWeight" + i, false); cWeight.Text = list[i - 1].Gross + "\r\n" + list[i - 1].Net; //币值 DevExpress.XtraReports.UI.XRTableCell cCoin = (DevExpress.XtraReports.UI.XRTableCell)Detail.FindControl("cCoin" + i, false); cCoin.Text = CommonReport.GetCode("118", list[i - 1].Curr_code.ToString(), true); DevExpress.XtraReports.UI.XRTableCell cPrice = (DevExpress.XtraReports.UI.XRTableCell)Detail.FindControl("cPrice" + i, false); cPrice.Text = list[i - 1].Unit_price.ToString(); DevExpress.XtraReports.UI.XRTableCell cTotal = (DevExpress.XtraReports.UI.XRTableCell)Detail.FindControl("cTotal" + i, false); cTotal.Text = list[i - 1].Trade_ttl.ToString(); #endregion } } } catch (Exception ex) { LogManager.WriteErrorLog(ex.Message.ToString()); } }
protected void btnsave_Click(object sender, EventArgs e) { try { if (Page.IsValid) { Customs custom = new Customs(); if (hidProdId.Value != "") { custom.Id = Convert.ToInt32(hidProdId.Value); } else { custom.Id = 0; } // custom.CustomerId = Convert.ToInt16(Request.QueryString[2]);// Convert.ToInt32(Session[SessionKey.Key.CustomerId.ToString()]); custom.CustomerId = Convert.ToInt32(Request.QueryString[SessionKey.Key.CustomerId.ToString()]); custom.Customer = txtCustomer.Text.Trim(); custom.ProposalCost = decimal.Parse(txtProposalCost.Text); custom.ProposalTerms = txtProposalTerm.Text.Trim(); custom.SpecialInstruction = txtspecialIns.Text; custom.WorkArea = txtworkarea.Text; custom.UserId = userId; custom.ProductTypeId = this.ProductTypeId; string xml = "<root>"; //Commented by Yogesh Keraliya : Technical intervie task#9 //Implemented drag and drop location image uploader so images will be stored in hidden file and from that need to get pic list //List<CustomerLocationPic> pics = (List<CustomerLocationPic>)ViewState[SessionKey.Key.PagedataTable.ToString()]; List <CustomerLocationPic> pics = GetUploadedLocationPictures(); var image = pics.AsEnumerable().Take(1); string mainImage = image.FirstOrDefault().LocationPicture; for (int i = 0; i < pics.Count; i++) { xml += "<pics><pic>" + pics[i].LocationPicture + "</pic></pics>"; } xml += "</root>"; custom.LocationImage = xml; custom.MainImage = mainImage; //if (fileAttachment.HasFile) //{ // if (fileAttachment.PostedFile.FileName != "") // { // custom.Attachment = fileAttachment.PostedFile.FileName; // string strFileNameWithPath = fileAttachment.PostedFile.FileName; // string strExtensionName = System.IO.Path.GetExtension(strFileNameWithPath); // string strFileName = System.IO.Path.GetFileName(strFileNameWithPath); // custom.Attachment = strFileName; // int intFileSize = fileAttachment.PostedFile.ContentLength; // if (intFileSize > 0) // { // if (File.Exists(Server.MapPath("~/UploadedFiles/") + strFileName) == true) // { // File.Delete(Server.MapPath("~/UploadedFiles/") + strFileName); // fileAttachment.PostedFile.SaveAs(Server.MapPath("~/UploadedFiles/") + strFileName); // } // else // { // fileAttachment.PostedFile.SaveAs(Server.MapPath("~/UploadedFiles/") + strFileName); // } // } // } //} //else //{ // if (lnkDownload.Visible) // { // custom.Attachment = lnkDownload.Text; // } // else { custom.Attachment = string.Empty; } //} if (lnkDownload.Text != "") { custom.Attachment = lnkDownload.Text; } else { custom.Attachment = string.Empty; } // custom.CustSuppliedMaterial = txtCustSupMaterial.Text.Trim(); if (drpMaterial.SelectedItem.Text == "other") { custom.CustSuppliedMaterial = txtCustSupMaterial.Text.Trim(); } else if (drpMaterial.SelectedItem.Text == "Select") { custom.CustSuppliedMaterial = ""; } else { custom.CustSuppliedMaterial = drpMaterial.SelectedItem.Text; } custom.IsCustSupMatApplicable = chkCustSupMaterial.Checked; //custom.MaterialStorage = txtStorage.Text.Trim(); if (drpStorage.SelectedItem.Text == "other") { custom.MaterialStorage = txtStorage.Text.Trim(); } else if (drpStorage.SelectedItem.Text == "Select") { custom.MaterialStorage = ""; } else { custom.MaterialStorage = drpStorage.SelectedItem.Text; } custom.IsMatStorageApplicable = chkStorage.Checked; custom.IsPermitRequired = chkPermit.Checked; custom.IsHabitat = chkHabitat.Checked; custom.Others = OtherText; bool result = CustomBLL.Instance.AddCustom(custom); Session["Proposal"] = txtProposalTerm.Text; if (result && custom.Id == 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "AlertBox", "alert('Product has been added successfully.');", true); ClearCustomData(); // Response.Redirect("~/Sr_App/ProductEstimate.aspx?CustomerId=" + custom.CustomerId, false); Response.Redirect("~/Sr_App/ProductEstimate.aspx", false); } else if (result && custom.Id > 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "AlertBox", "alert('Product has been updated successfully.');", true); ClearCustomData(); // Response.Redirect("~/Sr_App/ProductEstimate.aspx?CustomerId=" + custom.CustomerId, false); Response.Redirect("~/Sr_App/ProductEstimate.aspx", false); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "AlertBox", "alert('Unable to add Product.');", true); ClearCustomData(); } } } catch (Exception ex) { logManager.writeToLog(ex, "Custom", Request.ServerVariables["remote_addr"].ToString()); } }
protected void btnsave_Click(object sender, EventArgs e) { try { if (Page.IsValid) { Customs custom = new Customs(); if (hidProdId.Value != "") { custom.Id = Convert.ToInt32(hidProdId.Value); } else { custom.Id = 0; } // custom.CustomerId = Convert.ToInt16(Request.QueryString[2]);// Convert.ToInt32(Session[SessionKey.Key.CustomerId.ToString()]); custom.CustomerId = Convert.ToInt32(Request.QueryString[SessionKey.Key.CustomerId.ToString()]); custom.Customer = txtCustomer.Text.Trim(); custom.ProposalCost = decimal.Parse(txtProposalCost.Text); custom.ProposalTerms = txtProposalTerm.Text.Trim(); custom.SpecialInstruction = txtspecialIns.Text; custom.WorkArea = txtworkarea.Text; custom.UserId = userId; custom.ProductTypeId = this.ProductTypeId; string xml = "<root>"; string mainImage = ""; //List<CustomerLocationPic> pics = (List<CustomerLocationPic>)ViewState[SessionKey.Key.PagedataTable.ToString()]; //var image = pics.AsEnumerable().Take(1); //string mainImage = image.FirstOrDefault().LocationPicture; //for (int i = 0; i < pics.Count; i++) //{ // xml += "<pics><pic>" + pics[i].LocationPicture + "</pic></pics>"; //} //xml += "</root>"; foreach (RepeaterItem item in rptAttachment.Items) { if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem) { var imag = (HtmlImage)item.FindControl("imgIcon"); xml += "<pics><pic>" + ".." + Server.UrlDecode(imag.Src) + "</pic></pics>"; if (CommonFunction.IsImageFile(".." + Server.UrlDecode(imag.Src))) { mainImage = ".." + Server.UrlDecode(imag.Src); } } } xml += "</root>"; custom.LocationImage = xml; custom.MainImage = mainImage; #region commentedArea //if (fileAttachment.HasFile) //{ // if (fileAttachment.PostedFile.FileName != "") // { // custom.Attachment = fileAttachment.PostedFile.FileName; // string strFileNameWithPath = fileAttachment.PostedFile.FileName; // string strExtensionName = System.IO.Path.GetExtension(strFileNameWithPath); // string strFileName = System.IO.Path.GetFileName(strFileNameWithPath); // custom.Attachment = strFileName; // int intFileSize = fileAttachment.PostedFile.ContentLength; // if (intFileSize > 0) // { // if (File.Exists(Server.MapPath("~/UploadedFiles/") + strFileName) == true) // { // File.Delete(Server.MapPath("~/UploadedFiles/") + strFileName); // fileAttachment.PostedFile.SaveAs(Server.MapPath("~/UploadedFiles/") + strFileName); // } // else // { // fileAttachment.PostedFile.SaveAs(Server.MapPath("~/UploadedFiles/") + strFileName); // } // } // } //} //else //{ // if (lnkDownload.Visible) // { // custom.Attachment = lnkDownload.Text; // } // else { custom.Attachment = string.Empty; } //} #endregion if (lnkDownload.Text != "") { custom.Attachment = lnkDownload.Text; } else { custom.Attachment = string.Empty; } custom.CustSuppliedMaterial = txtCustSupMaterial.Text.Trim(); custom.IsCustSupMatApplicable = chkCustSupMaterial.Checked; custom.MaterialStorage = txtStorage.Text.Trim(); custom.IsMatStorageApplicable = chkStorage.Checked; custom.IsPermitRequired = chkPermit.Checked; custom.IsHabitat = chkHabitat.Checked; custom.Others = OtherText; bool result = CustomBLL.Instance.AddCustom(custom); Session["Proposal"] = txtProposalTerm.Text; if (result && custom.Id == 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "AlertBox", "alert('Product has been added successfully.');", true); ClearCustomData(); // Response.Redirect("~/Sr_App/ProductEstimate.aspx?CustomerId=" + custom.CustomerId, false); Response.Redirect("~/Sr_App/ProductEstimate.aspx", false); } else if (result && custom.Id > 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "AlertBox", "alert('Product has been updated successfully.');", true); ClearCustomData(); // Response.Redirect("~/Sr_App/ProductEstimate.aspx?CustomerId=" + custom.CustomerId, false); Response.Redirect("~/Sr_App/ProductEstimate.aspx", false); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "AlertBox", "alert('Unable to add Product.');", true); ClearCustomData(); } } } catch (Exception ex) { logManager.writeToLog(ex, "Custom", Request.ServerVariables["remote_addr"].ToString()); } }