Exemplo n.º 1
0
        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");
        }