void SetupPage()
        {
            this.SetupPage_Lookups();

            this.Txt_EmployeeCode.Text = (string)Do_Methods.IsNull(this.mObj.pDr["EmployeeCode"], "");

            this.Txt_LeaveVacation.Text    = Convert.ToInt32(Do_Methods.IsNull(this.mObj.pDr["Leave_Vacation"], 0)).ToString("#,##0");    //Methods.Convert_Int32(this.mObj.pDr["Leave_Vacation"]).ToString();
            this.Txt_LeaveSick.Text        = Convert.ToInt32(Do_Methods.IsNull(this.mObj.pDr["Leave_Sick"], 0)).ToString("#,##0");        //Methods.Convert_Int32(this.mObj.pDr["Leave_Sick"]).ToString();
            this.Txt_LeaveBereavement.Text = Convert.ToInt32(Do_Methods.IsNull(this.mObj.pDr["Leave_Bereavement"], 0)).ToString("#,##0"); //Methods.Convert_Int32(this.mObj.pDr["Leave_Bereavement"]).ToString();

            this.Txt_Position.Text = (string)Do_Methods.IsNull(this.mObj.pDr["Position"], "");
            this.Txt_Pay.Text      = Do_Methods.Convert_Double(this.mObj.pDr["Pay"].ToString()).ToString("#,##0.00");
            this.Txt_SIN.Text      = (string)Do_Methods.IsNull(this.mObj.pDr["SIN"], "");

            this.EODtp_DateHired.VisibleDate  = DateTime.Now;
            this.EODtp_DateHired.SelectedDate = !Microsoft.VisualBasic.Information.IsDBNull(this.mObj.pDr["DateHired"]) ? (DateTime)this.mObj.pDr["DateHired"] : new DateTime();

            this.EODtp_DateTerminate.VisibleDate  = DateTime.Now;
            this.EODtp_DateTerminate.SelectedDate = !Microsoft.VisualBasic.Information.IsDBNull(this.mObj.pDr["DateTerminate"]) ? (DateTime)this.mObj.pDr["DateTerminate"] : new DateTime();

            DataTable Dt_Defaults = Do_Methods_Query.GetQuery("uvw_Lookup");

            this.Cbo_Department.SelectedValue   = ((Int64)Do_Methods.IsNull(this.mObj.pDr["LookupID_Department"], this.SetupPage_GetLookupDefault(Dt_Defaults, Layer01_Constants.eLookup.Department))).ToString();
            this.Cbo_PayRate.SelectedValue      = ((Int64)Do_Methods.IsNull(this.mObj.pDr["LookupID_PayRate"], this.SetupPage_GetLookupDefault(Dt_Defaults, Layer01_Constants.eLookup.PayRate))).ToString();
            this.Cbo_EmployeeType.SelectedValue = ((Int64)Do_Methods.IsNull(this.mObj.pDr["LookupID_EmployeeType"], this.SetupPage_GetLookupDefault(Dt_Defaults, Layer01_Constants.eLookup.EmployeeType))).ToString();

            this.UcPerson.Setup(this.mObj.pObj_Person);
            this.UcAddress.Setup(this.mObj.pObj_Address);
        }
        protected override void Save()
        {
            System.Text.StringBuilder Sb_ErrorMsg = new System.Text.StringBuilder();
            if (!this.Save_Validation(ref Sb_ErrorMsg))
            {
                this.Show_EventMsg(Sb_ErrorMsg.ToString(), ClsBaseMasterDetails.eStatus.Event_Error);
                return;
            }

            //[-]

            this.mObj.pDr_RowProperty["Code"]      = this.Txt_EmployeeCode.Text;
            this.mObj.pDr["Leave_Vacation"]        = Do_Methods.Convert_Int32(this.Txt_LeaveSick.Text);
            this.mObj.pDr["Leave_Sick"]            = Do_Methods.Convert_Int32(this.Txt_LeaveSick.Text);
            this.mObj.pDr["Leave_Bereavement"]     = Do_Methods.Convert_Int32(this.Txt_LeaveBereavement.Text);
            this.mObj.pDr["Position"]              = this.Txt_Position.Text;
            this.mObj.pDr["LookupID_Department"]   = Do_Methods.Convert_Int64(this.Cbo_Department.SelectedValue);
            this.mObj.pDr["LookupID_PayRate"]      = Do_Methods.Convert_Int64(this.Cbo_PayRate.SelectedValue);
            this.mObj.pDr["LookupID_EmployeeType"] = Do_Methods.Convert_Int64(this.Cbo_EmployeeType.SelectedValue);
            this.mObj.pDr["SIN"] = this.Txt_SIN.Text;
            this.mObj.pDr["Pay"] = Do_Methods.Convert_Double(this.Txt_Pay.Text);

            this.UcPerson.Update();
            this.UcAddress.Update();

            Do_Methods.ConvertCaps(this.mObj.pDr_RowProperty);
            Do_Methods.ConvertCaps(this.mObj.pDr_Person);
            Do_Methods.ConvertCaps(this.mObj.pDr);

            //[-]

            base.Save();
        }
        public override bool Save(DataObjects_Framework.DataAccess.Interface_DataAccess Da = null)
        {
            bool Rv = base.Save(Da);

            Int64     ItemID = Do_Methods.Convert_Int64(this.pDr["ItemID"]);
            double    Price  = 0;
            DataTable Dt     = Do_Methods_Query.ExecuteQuery("Select Top 1 Price From Item_PriceHistory Where ItemID = " + ItemID + " Order By DatePosted").Tables[0];

            if (Dt.Rows.Count > 0)
            {
                Price = Do_Methods.Convert_Double(Dt.Rows[0]["Price"]);
            }

            if (Price != Do_Methods.Convert_Double(this.pDr["Price"], 0))
            {
                this.UpdatePriceHistory(ItemID);
            }

            return(Rv);
        }
Example #4
0
        protected override void Save()
        {
            System.Text.StringBuilder Sb_ErrorMsg = new System.Text.StringBuilder();
            if (!this.Save_Validation(ref Sb_ErrorMsg))
            {
                this.Show_EventMsg(Sb_ErrorMsg.ToString(), ClsBaseMasterDetails.eStatus.Event_Error);
                return;
            }

            this.UcPerson.Update();
            this.UcAddress.Update();

            this.mObj.pDr_RowProperty["Code"]     = this.Txt_Code.Text;
            this.mObj.pDr["Company"]              = this.Txt_Company.Text;
            this.mObj.pDr["LookupTaxCodeID"]      = Convert.ToInt64(this.Cbo_TaxCode.SelectedValue);
            this.mObj.pDr["LookupClientTypeID"]   = Convert.ToInt64(this.Cbo_ClientType.SelectedValue);
            this.mObj.pDr["LookupID_ShipVia"]     = Convert.ToInt64(this.Cbo_ShipVia.SelectedValue);
            this.mObj.pDr["LookupID_Currency"]    = Convert.ToInt64(this.Cbo_Currency.SelectedValue);
            this.mObj.pDr["LookupID_PaymentTerm"] = Convert.ToInt64(this.Cbo_PaymentTerm.SelectedValue);

            this.mObj.pDr["IsCreditHold"]           = this.Chk_IsCreditHold.Checked;
            this.mObj.pDr["CreditCard_AccountName"] = this.Txt_CreditCard_AccountName.Text;

            Int32 CreditCardExpiration_Month = 0;
            Int32 CreditCardExpiration_Year  = 0;

            try
            {
                Int32.TryParse(this.Txt_CreditCardExpiration_Month.Text, out CreditCardExpiration_Month);
                if (this.Txt_CreditCardExpiration_Year.Text.Trim() != "")
                {
                    Int32.TryParse("20" + this.Txt_CreditCardExpiration_Year.Text, out CreditCardExpiration_Year);
                }
            }
            catch { }

            if (
                (this.Txt_CreditCardExpiration_Month.Text.Trim() == "" ||
                 this.Txt_CreditCardExpiration_Year.Text.Trim() == ""))
            {
                this.mObj.pDr["CreditCard_Expiration"] = DBNull.Value;
            }
            else
            {
                try
                { this.mObj.pDr["CreditCard_Expiration"] = new DateTime(CreditCardExpiration_Year, CreditCardExpiration_Month, 1); }
                catch
                { this.mObj.pDr["CreditCard_Expiration"] = DBNull.Value; }
            }

            this.mObj.pDr["CreditCard_CVV"] = this.Txt_CreditCard_CVV.Text;

            this.mObj.pDr["CreditCardNo1"] = this.Txt_CreditCard_Part1.Text;
            this.mObj.pDr["CreditCardNo2"] = this.Txt_CreditCard_Part2.Text;
            this.mObj.pDr["CreditCardNo3"] = this.Txt_CreditCard_Part3.Text;
            this.mObj.pDr["CreditCardNo4"] = this.Txt_CreditCard_Part4.Text;

            this.mObj.pDr["CreditLimit"] = Do_Methods.Convert_Double(this.Txt_CreditLimit.Text);

            Do_Methods.ConvertCaps(this.mObj.pDr_RowProperty);
            Do_Methods.ConvertCaps(this.mObj.pDr_Person);
            Do_Methods.ConvertCaps(this.mObj.pDr_Address);
            Do_Methods.ConvertCaps(this.mObj.pDr);

            base.Save();
        }
        protected override void Save()
        {
            this.UcGrid_ItemPart.Post();
            this.UcGrid_ItemLocation.Post();
            this.UcGrid_ItemSupplier.Post();

            //[-]

            //System.Text.StringBuilder Sb_ErrorMsg = new System.Text.StringBuilder();
            //if (!this.Save_Validation(ref Sb_ErrorMsg))
            //{
            //    this.Show_EventMsg(Sb_ErrorMsg.ToString(), ClsBaseMasterDetails.eStatus.Event_Error);
            //    return;
            //}

            //[-]

            this.mObj.pDr_RowProperty["Code"]    = this.Txt_ItemCode.Text;
            this.mObj.pDr_RowProperty["Name"]    = this.Txt_ItemName.Text;
            this.mObj.pDr_RowProperty["Remarks"] = this.Txt_Remarks.Text;

            this.mObj.pDr["Warranty"]          = this.Txt_Warranty.Text;
            this.mObj.pDr["IsSerial"]          = this.Chk_IsSerial.Checked;
            this.mObj.pDr["LookupID_ItemType"] = Convert.ToInt64(this.Cbo_ItemType.SelectedValue);
            this.mObj.pDr["LookupID_Brand"]    = Convert.ToInt64(this.Cbo_Brand.SelectedValue);
            this.mObj.pDr["LookupID_Retailer"] = Convert.ToInt64(this.Cbo_Retailer.SelectedValue);
            this.mObj.pDr["LookupID_ItemUOM"]  = Convert.ToInt64(this.Cbo_ItemUOM.SelectedValue);

            this.mObj.pDr["Size_Length"] = Do_Methods.Convert_Double(this.Txt_Length.Text);
            this.mObj.pDr["Size_Width"]  = Do_Methods.Convert_Double(this.Txt_Width.Text);
            this.mObj.pDr["Size_Height"] = Do_Methods.Convert_Double(this.Txt_Height.Text);
            this.mObj.pDr["Size_Weight"] = Do_Methods.Convert_Double(this.Txt_Weight.Text);

            this.mObj.pDr["Inv_FloorLevel"]   = Do_Methods.Convert_Int64(this.Txt_FloorLevel.Text);
            this.mObj.pDr["Inv_ReorderLevel"] = Do_Methods.Convert_Int64(this.Txt_ReorderLevel.Text);
            this.mObj.pDr["Inv_CeilingLevel"] = Do_Methods.Convert_Int64(this.Txt_CeilingLevel.Text);

            this.mObj.pDr["Cost"]  = Do_Methods.Convert_Double(this.Txt_EstimatedCost.Text);
            this.mObj.pDr["Price"] = Do_Methods.Convert_Double(this.Txt_ListPrice.Text);

            Do_Methods.ConvertCaps(this.mObj.pDr_RowProperty);
            Do_Methods.ConvertCaps(this.mObj.pDr);

            //[-]

            ClsItemValidation Obj_Validation = new ClsItemValidation();

            Obj_Validation.Setup(this.mObj);
            if (!Obj_Validation.Validate())
            {
                this.Txt_ItemCode.CssClass = Layer01_Constants_Web.CnsCssTextbox;
                //if (Obj_Validation.pList_ValidationError.Exists(X => X.Name == ClsItemValidation.eErrors.Err_Code.ToString()))
                if (Obj_Validation.FindError(ClsItemValidation.eErrors.Err_Code.ToString()))
                {
                    this.Txt_ItemCode.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight;
                }

                this.Txt_ItemName.CssClass = Layer01_Constants_Web.CnsCssTextbox;
                //if (Obj_Validation.pList_ValidationError.Exists(X => X.Name == ClsItemValidation.eErrors.Err_Name.ToString()))
                if (Obj_Validation.FindError(ClsItemValidation.eErrors.Err_Name.ToString()))
                {
                    this.Txt_ItemName.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight;
                }

                //List<String> Msg = (from O in Obj_Validation.pList_ValidationError select O.Message).ToList();
                //this.Show_EventMsg(Msg, ClsBaseMasterDetails.eStatus.Event_Error);

                this.Show_EventMsg(Obj_Validation.GetErrors(), ClsBaseMasterDetails.eStatus.Event_Error);
            }

            //[-]

            base.Save();
        }
        void SetupPage()
        {
            this.SetupPage_ControlAttributes();
            this.SetupPage_Lookups();

            //[-]

            this.Txt_ItemCode.Text = Do_Methods.Convert_String(this.mObj.pDr_RowProperty["Code"]);
            this.Txt_ItemName.Text = Do_Methods.Convert_String(this.mObj.pDr_RowProperty["Name"]);
            this.Txt_Remarks.Text  = Do_Methods.Convert_String(this.mObj.pDr_RowProperty["Remarks"]);
            this.Txt_Warranty.Text = Do_Methods.Convert_String(this.mObj.pDr["Warranty"]);

            this.Chk_IsSerial.Checked = Do_Methods.Convert_Boolean(this.mObj.pDr["IsSerial"]);

            this.Txt_Length.Text = Do_Methods.Convert_Double(this.mObj.pDr["Size_Length"]).ToString("#,##0.0000");
            this.Txt_Width.Text  = Do_Methods.Convert_Double(this.mObj.pDr["Size_Width"]).ToString("#,##0.0000");
            this.Txt_Height.Text = Do_Methods.Convert_Double(this.mObj.pDr["Size_Height"]).ToString("#,##0.0000");
            this.Txt_Weight.Text = Do_Methods.Convert_Double(this.mObj.pDr["Size_Weight"]).ToString("#,##0.0000");

            this.Txt_FloorLevel.Text   = Do_Methods.Convert_Int64(this.mObj.pDr["Inv_FloorLevel"]).ToString("#,##0");
            this.Txt_CeilingLevel.Text = Do_Methods.Convert_Int64(this.mObj.pDr["Inv_CeilingLevel"]).ToString("#,##0");
            this.Txt_ReorderLevel.Text = Do_Methods.Convert_Int64(this.mObj.pDr["Inv_ReorderLevel"]).ToString("#,##0");

            this.Txt_EstimatedCost.Text = Do_Methods.Convert_Double(this.mObj.pDr["Cost"]).ToString("#,##0.00");
            this.Txt_ListPrice.Text     = Do_Methods.Convert_Double(this.mObj.pDr["Price"], 0).ToString("#,##0.00");

            bool IsImageFile = false;

            if ((string)Do_Methods.IsNull(this.mObj.pDr["Image_Path"], "") != "")
            {
                IsImageFile = true;
                System.IO.FileInfo Fi_Thumb =
                    new System.IO.FileInfo(
                        this.MapPath(Layer01_Constants_Web.CnsImageThumbPath
                                     + "Thumb_"
                                     + (string)Do_Methods.IsNull(this.mObj.pDr["Image_Path"], "")));
                if (!Fi_Thumb.Exists)
                {
                    try
                    {
                        Layer01_Methods_Web.ImageThumbnail(
                            this.MapPath(Layer01_Constants_Web.CnsImageThumbPath
                                         + (string)Do_Methods.IsNull(this.mObj.pDr["Image_Path"], ""))
                            , Fi_Thumb.FullName);
                    }
                    catch
                    { IsImageFile = false; }
                }

                this.Img_Box.ImageUrl      = Layer01_Constants_Web.CnsImageThumbPath + "Thumb_" + (string)Do_Methods.IsNull(this.mObj.pDr["Image_Path"], "");
                this.Btn_ViewImage.Visible = true;
            }

            if (!IsImageFile)
            {
                this.Img_Box.ImageUrl      = "~/System/Images/QuestionMark001.jpg";
                this.Btn_ViewImage.Visible = false;
            }

            if ((string)Do_Methods.IsNull(this.mObj.pDr["PdfDesc_Path"], "") == "")
            {
                this.Btn_PdfDesc.CssClass = Layer01_Constants_Web.CnsCssControlEnabledFalse;
                this.Btn_PdfDesc.Enabled  = false;
            }
            else
            {
                this.Btn_PdfDesc.CssClass = Layer01_Constants_Web.CnsCssControlEnabled;
                this.Btn_PdfDesc.Enabled  = true;
            }

            if ((string)Do_Methods.IsNull(this.mObj.pDr["PdfFaq_Path"], "") == "")
            {
                this.Btn_PdfFaq.CssClass = Layer01_Constants_Web.CnsCssControlEnabledFalse;
                this.Btn_PdfFaq.Enabled  = false;
            }
            else
            {
                this.Btn_PdfFaq.CssClass = Layer01_Constants_Web.CnsCssControlEnabled;
                this.Btn_PdfFaq.Enabled  = true;
            }

            if ((string)Do_Methods.IsNull(this.mObj.pDr["PdfOthers_Path"], "") == "")
            {
                this.Btn_PdfOther.CssClass = Layer01_Constants_Web.CnsCssControlEnabledFalse;
                this.Btn_PdfOther.Enabled  = false;
            }
            else
            {
                this.Btn_PdfOther.CssClass = Layer01_Constants_Web.CnsCssControlEnabled;
                this.Btn_PdfOther.Enabled  = true;
            }

            DataTable Dt_Defaults = Do_Methods_Query.GetQuery("uvw_Lookup");

            this.Cbo_Category.SelectedValue = ((Int64)Do_Methods.IsNull(this.mObj.pDr["LookupID_Category"], this.SetupPage_GetLookupDefault(Dt_Defaults, Layer01_Constants.eLookup.Category))).ToString();
            this.Cbo_ItemType.SelectedValue = ((Int64)Do_Methods.IsNull(this.mObj.pDr["LookupID_ItemType"], this.SetupPage_GetLookupDefault(Dt_Defaults, Layer01_Constants.eLookup.ItemType))).ToString();
            this.Cbo_Brand.SelectedValue    = ((Int64)Do_Methods.IsNull(this.mObj.pDr["LookupID_Brand"], this.SetupPage_GetLookupDefault(Dt_Defaults, Layer01_Constants.eLookup.Brand))).ToString();
            this.Cbo_Retailer.SelectedValue = ((Int64)Do_Methods.IsNull(this.mObj.pDr["LookupID_Category"], this.SetupPage_GetLookupDefault(Dt_Defaults, Layer01_Constants.eLookup.Retailer))).ToString();
            this.Cbo_ItemUOM.SelectedValue  = ((Int64)Do_Methods.IsNull(this.mObj.pDr["LookupID_ItemUOM"], this.SetupPage_GetLookupDefault(Dt_Defaults, Layer01_Constants.eLookup.UOM))).ToString();

            //[-]

            this.UcGrid_ItemPart.Setup(
                "Item_Part"
                , this.mObj.pDt_Part
                , "TmpKey"
                , false
                , true
                , this.mMaster.pIsReadOnly);
            this.UcGrid_ItemPart.pGrid.FullRowMode = false;

            this.UcGrid_ItemLocation.Setup(
                "Item_Location"
                , this.mObj.pDt_Location
                , "TmpKey"
                , false
                , true
                , this.mMaster.pIsReadOnly);
            this.UcGrid_ItemLocation.pGrid.FullRowMode = false;

            this.UcGrid_ItemSupplier.Setup(
                "Item_Supplier"
                , this.mObj.pDt_Supplier
                , "TmpKey"
                , false
                , true
                , this.mMaster.pIsReadOnly);
            this.UcGrid_ItemSupplier.pGrid.FullRowMode = false;

            DataTable Dt = Do_Methods_Query.GetQuery(
                "uvw_Materialized_InventoryWarehouse_Current_Item"
                , ""
                , "ItemID = " + Convert.ToInt64(Do_Methods.IsNull(this.mObj.pDr["ItemID"], 0)).ToString()
                , "WarehouseCodeName");

            this.mObj.AddRequired(Dt);
            this.UcGrid_OnHand.Setup("Item_Inventory", Dt);
            this.UcGrid_OnHand.pGrid.FullRowMode = false;
        }