protected void btncustomernext_Click(object sender, System.EventArgs e) { CustomProfile profile = CustomProfile.GetProfile(); iWarehouseClient WarehouseClient = new iWarehouseClient(); try { mWarehouseMaster WHDetail = new mWarehouseMaster(); tAddress address = new tAddress(); WHDetail.Code = txtcode.Text.ToString(); WHDetail.WarehouseName = txtwarehousename.Text.ToString(); WHDetail.Type = ddltype.SelectedItem.Text; WHDetail.Description = txtdescription.Text.ToString(); WHDetail.Remark = txtremark.Text.ToString(); WHDetail.Active = "No"; if (rbtYes.Checked == true) { WHDetail.Active = "Yes"; } WHDetail.CompanyID = long.Parse(hdncompanyid.Value); WHDetail.CustomerID = long.Parse(hdncustomerid.Value); WHDetail.CreatedBy = profile.Personal.UserID; WHDetail.CreationDate = DateTime.Now; address.AddressLine1 = txtCAddress1.Text.ToString(); address.AddressLine2 = txtAddress2.Text.ToString(); address.Zipcode = txtZipCode.Text.ToString(); address.County = hdnCountry.Value; address.State = hdncountryState.Value; address.City = txtCity.Text.ToString(); address.ObjectName = "Warehouse"; address.Active = "Y"; address.CreatedBy = profile.Personal.UserID.ToString(); address.CreationDate = DateTime.Now; address.CompanyID = long.Parse(hdncompanyid.Value); address.AddressType = "Warehouse"; hdnWarehouseName.Value = txtwarehousename.Text.ToString(); Session["WarehouseName"] = txtwarehousename.Text.ToString(); long WarehouseID = 0; WarehouseID = WarehouseClient.SaveWarehouseMaster(WHDetail, profile.DBConnection._constr); address.ReferenceID = WarehouseID; long AddressID = WarehouseClient.SaveWarehouseAddress(address, profile.DBConnection._constr); hdnwarehouseID.Value = WarehouseID.ToString(); Session.Add("CompanyID", hdncompanyid.Value); if (hdnwarehouseID.Value != "0") { ActiveTab("Next"); btncustomernext.Visible = false; } else { WebMsgBox.MsgBox.Show("Error Occured"); } } catch (Exception ex) { Login.Profile.ErrorHandling(ex, this, "Warehouse Master", "Buttonnextsave"); } finally { } }
protected void pageSave(Object sender, BrilliantWMS.ToolbarService.iUCToolbarClient e) { CustomProfile profile = CustomProfile.GetProfile(); iWarehouseClient Warehouseclient = new iWarehouseClient(); mWarehouseMaster WHDetail = new mWarehouseMaster(); tAddress address = new tAddress(); if (hdnstate.Value == "Edit") { WHDetail = Warehouseclient.GetWarehouseMasterByID(long.Parse(hdnwarehouseID.Value), profile.DBConnection._constr); address = Warehouseclient.GetWarehouseAddress(long.Parse(hdnwarehouseID.Value), profile.DBConnection._constr); } WHDetail.Code = txtcode.Text.ToString(); WHDetail.WarehouseName = txtwarehousename.Text.ToString(); WHDetail.Type = ddltype.SelectedItem.Text; WHDetail.Description = txtdescription.Text.ToString(); WHDetail.Remark = txtremark.Text.ToString(); WHDetail.Active = "No"; if (rbtYes.Checked == true) { WHDetail.Active = "Yes"; } WHDetail.CompanyID = long.Parse(hdncompanyid.Value); if (hdncustomerid.Value != "") { WHDetail.CustomerID = long.Parse(hdncustomerid.Value); } else { WHDetail.CustomerID = long.Parse(hdnNewCustomerID.Value); } WHDetail.CreatedBy = profile.Personal.UserID; WHDetail.CreationDate = DateTime.Now; address.AddressLine1 = txtCAddress1.Text.ToString(); address.AddressLine2 = txtAddress2.Text.ToString(); address.Zipcode = txtZipCode.Text.ToString(); address.County = hdnCountry.Value; address.State = hdncountryState.Value; address.City = txtCity.Text.ToString(); address.ObjectName = "Warehouse"; address.Active = "Y"; address.CreatedBy = profile.Personal.UserID.ToString(); address.CreationDate = DateTime.Now; address.CompanyID = long.Parse(hdncompanyid.Value); address.AddressType = "Warehouse"; if (hdnstate.Value == "Edit") { WHDetail.ModifiedBy = profile.Personal.UserID; WHDetail.ModifiedDate = DateTime.Now; address.LastModifiedBy = profile.Personal.UserID.ToString(); address.LastModifiedDate = DateTime.Now; long WarehouseID = Warehouseclient.SaveWarehouseMaster(WHDetail, profile.DBConnection._constr); address.ReferenceID = WarehouseID; long AddressID = Warehouseclient.SaveWarehouseAddress(address, profile.DBConnection._constr); UCContactPerson1.FinalSaveContactPerson("Warehouse", long.Parse(hdnwarehouseID.Value)); UCContactPerson1.ClearContactPerson("Warehouse"); WebMsgBox.MsgBox.Show("Record Updated successfully"); } else { long WarehouseID = Warehouseclient.SaveWarehouseMaster(WHDetail, profile.DBConnection._constr); address.ReferenceID = WarehouseID; hdnwarehouseID.Value = WarehouseID.ToString(); long AddressID = Warehouseclient.SaveWarehouseAddress(address, profile.DBConnection._constr); UCContactPerson1.FinalSaveContactPerson("Warehouse", long.Parse(hdnwarehouseID.Value)); UCContactPerson1.ClearContactPerson("Warehouse"); WebMsgBox.MsgBox.Show("Record saved successfully"); } clear(); Response.Redirect("WarehouseMaster.aspx"); }