示例#1
0
        public override bool Validate()
        {
            base.mList_ValidationError.Clear();
            ClsItem Obj = (ClsItem)base.mBase;

            if (Do_Methods.Convert_String(Obj.pDr_RowProperty["Code"]) == "")
            {
                Obj.pDr_RowProperty["Code"] = Layer02_Common.GetSeriesNo("Item");
            }

            if (
                Layer02_Common.CheckSeriesDuplicate(
                    "uvw_Item"
                    , "Code"
                    , Obj.GetKeys()
                    , Do_Methods.Convert_String(Obj.pDr_RowProperty["Code"]))
                )
            {
                base.AddError(
                    eErrors.Err_Code.ToString()
                    , "Duplicate Item No. found. Please change the Item No.");;
            }

            if (Do_Methods.Convert_String(Obj.pDr_RowProperty["Name"]) != "")
            {
                base.AddError(
                    eErrors.Err_Name.ToString()
                    , "Item Name is required.");
            }

            return(base.mList_ValidationError.Count == 0);
        }
        public Interface_DataAccess CreateDataAccess()
        {
            Interface_DataAccess Da = Do_Methods.CreateDataAccess();

            try
            {
                if (this.mIsCache)
                {
                    Da.Connect(Do_Methods.Convert_String(Do_Globals.gSettings.pCollection[Layer01_Constants.CnsConnectionString_Cache]));
                }
                else
                {
                    Da.Connect();
                }
            }
            catch (Exception Ex) { throw Ex; }
            return(Da);
        }
        void BindGrid_Details_Filter()
        {
            DataTable Dt_FilterFields = (this.ViewState[CnsDt_FilterFields] != null) ? (DataTable)this.ViewState[CnsDt_FilterFields] : null;
            string    FilterText      = "";

            DataRow[] ArrDr = Dt_FilterFields.Select("Field = '" + this.Cbo_SearchFilter.SelectedValue + "'");
            if (ArrDr.Length > 0)
            {
                Type Inner_DataType = Type.GetType(Do_Methods.Convert_String(ArrDr[0]["DataType"]));

                FilterText = Do_Methods.PrepareFilterText(
                    (string)Do_Methods.IsNull(ArrDr[0]["Field"], "")
                    , Inner_DataType
                    , this.Txt_Search.Text);
            }

            this.UcGrid_Details.pDt_Source.DefaultView.RowFilter = FilterText;
        }
示例#4
0
        public override void Load(Keys Keys, DataObjects_Framework.BaseObjects.Base Obj_Parent = null)
        {
            Interface_DataAccess Da = Do_Methods.CreateDataAccess();

            try
            {
                if (this.mIsCache)
                {
                    Da.Connect(Do_Methods.Convert_String(Do_Globals.gSettings.pCollection[Layer01_Constants.CnsConnectionString_Cache]));
                }
                else
                {
                    Da.Connect();
                }

                base.Load(Da, Keys, Obj_Parent);
            }
            catch (Exception Ex) { throw Ex; }
            finally { Da.Close(); }
        }
        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;
        }