Пример #1
0
        public static List <ClsBindGridColumn> GetBindGridColumn(string Name)
        {
            List <ClsBindGridColumn> List_Gc = new List <ClsBindGridColumn>();
            ClsBindGridColumn        Gc;

            DataTable Dt_Def = Do_Methods_Query.GetQuery(@"udf_System_BindDefinition('" + Name + "')", "", "", "OrderIndex");

            foreach (DataRow Dr in Dt_Def.Rows)
            {
                Gc = new ClsBindGridColumn(
                    (string)Do_Methods.IsNull(Dr["Name"], "")
                    , (string)Do_Methods.IsNull(Dr["Desc"], "")
                    , (Int32)Do_Methods.IsNull(Dr["Width"], 0)
                    , (string)Do_Methods.IsNull(Dr["NumberFormat"], "")
                    , (Layer01_Common.Common.Layer01_Constants.eSystem_Lookup_FieldType)Do_Methods.IsNull(Dr["System_LookupID_FieldType"], Layer01_Common.Common.Layer01_Constants.eSystem_Lookup_FieldType.FieldType_Static)
                    , !(bool)Do_Methods.IsNull(Dr["IsHidden"], false)
                    , !(bool)Do_Methods.IsNull(Dr["IsReadOnly"], false));

                Gc.mButtonType = (ButtonColumnType)Do_Methods.IsNull(Dr["System_LookupID_ButtonType"], ButtonColumnType.LinkButton);
                Gc.mFieldText  = (string)Do_Methods.IsNull(Dr["FieldText"], "");

                List_Gc.Add(Gc);
            }

            return(List_Gc);
        }
        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);
        }
Пример #3
0
        void SetupPage()
        {
            DataTable Dt =
                Do_Methods_Query.GetQuery(
                    "System_Modules"
                    , ""
                    , "System_ModulesID = " + this.mSystem_ModulesID);

            string Override_ModuleName = (string)this.ViewState[CnsModuleName];

            if (Override_ModuleName == "")
            {
                if (Dt.Rows.Count > 0)
                {
                    Override_ModuleName = (string)Do_Methods.IsNull(Dt.Rows[0]["Name"], "");
                }
            }

            this.Lbl_ModuleName.Text = Override_ModuleName;

            if (!this.mCurrentUser.CheckAccess(this.mSystem_ModulesID, Layer01_Common.Common.Layer01_Constants.eAccessLib.eAccessLib_Access))
            {
                throw new Exception("You have no access in this page.");
            }

            if (!this.mCurrentUser.CheckAccess(this.mSystem_ModulesID, Layer01_Common.Common.Layer01_Constants.eAccessLib.eAccessLib_New))
            {
                this.Btn_New.Enabled = false;
            }

            this.Txt_Top.Text = "50";
            this.BindGrid();
            this.Lbl_AppliedFilters.Text = this.Details_ItemsCount();
            this.RaiseSetupPage_Done();
        }
Пример #4
0
        public void UpdatePriceHistory(Int64 ItemID)
        {
            DataTable Dt_Item = Do_Methods_Query.GetQuery("Item", "", "ItemID = " + ItemID);
            DataRow   Dr_Item = null;

            if (Dt_Item.Rows.Count > 0)
            {
                Dr_Item = Dt_Item.Rows[0];
            }
            else
            {
                return;
            }

            DateTime  ServerDate      = Layer02_Common.GetServerDate();
            DataTable Dt_PriceHistory = Do_Methods_Query.GetQuery("Item_PriceHistory", "", "1 = 0");
            DataRow   Dr_PriceHistory = Dt_PriceHistory.NewRow();

            Dr_PriceHistory["ItemID"] = ItemID;
            Dr_PriceHistory["Price"]  = Dr_Item["Price"];
            Dr_PriceHistory["EmployeeID_PostedBy"] = this.mCurrentUser.pDrUser["EmployeeID"];
            Dr_PriceHistory["DatePosted"]          = ServerDate;

            Interface_DataAccess Da = Do_Methods.CreateDataAccess();

            try
            {
                Da.Connect();
                Da.SaveDataRow(Dr_PriceHistory, "Item_PriceHistory");
            }
            catch { }
            finally
            { Da.Close(); }
        }
        public static List <ClsBindGridColumn_EO> BindEOGrid(
            ref EO.Web.Grid EOGrid
            , string Name
            , string TableKey = ""
            , bool AllowSort  = true
            , bool HasDelete  = false)
        {
            DataTable Dt_Bind = Do_Methods_Query.GetQuery("System_BindDefinition", "", @"Name = '" + Name + "'");
            DataRow   Dr_Bind;

            if (Dt_Bind.Rows.Count > 0)
            {
                Dr_Bind = Dt_Bind.Rows[0];
            }
            else
            {
                throw new Exception("Bind Definition not found.");
            }

            List <ClsBindGridColumn_EO> Gc = GetBindGridColumn_EO(Name);
            DataTable Dt = Do_Methods_Query.GetQuery(
                (string)Do_Methods.IsNull(Dr_Bind["TableName"], "")
                , ""
                , (string)Do_Methods.IsNull(Dr_Bind["Condition"], "")
                , (string)Do_Methods.IsNull(Dr_Bind["Sort"], ""));

            if (TableKey.Trim() != "")
            {
                TableKey = (string)Do_Methods.IsNull(Dr_Bind["TableKey"], "");
            }

            BindEOGrid(ref EOGrid, Dt, Gc, TableKey, AllowSort, HasDelete);

            return(Gc);
        }
        void Back()
        {
            DataTable Dt  = Do_Methods_Query.GetQuery("System_Modules", "", "System_ModulesID = " + this.mSystem_ModulesID.ToString());
            string    Url = "";

            if (Dt.Rows.Count > 0)
            {
                Url = "~/" + (string)Do_Methods.IsNull(Dt.Rows[0]["PageUrl_List"], "");
            }
            this.Response.Redirect(Url);
        }
Пример #7
0
        void SetupPage()
        {
            this.SetupPage_Lookups();

            this.Txt_Code.Text                   = (string)Do_Methods.IsNull(this.mObj.pDr_RowProperty["Code"], "");
            this.Txt_Company.Text                = (string)Do_Methods.IsNull(this.mObj.pDr["Company"], "");
            this.Lbl_SalesPerson.Text            = (string)Do_Methods.IsNull(this.mObj.pDr["EmployeeCodeName_SalesPerson"], "-Select-");
            this.Txt_CreditCard_AccountName.Text = (string)Do_Methods.IsNull(this.mObj.pDr["CreditCard_AccountName"], "");

            if (!Information.IsDBNull(this.mObj.pDr["CreditCard_Expiration"]))
            {
                DateTime CreditCard_Expiration = (DateTime)this.mObj.pDr["CreditCard_Expiration"];
                this.Txt_CreditCardExpiration_Month.Text = CreditCard_Expiration.Month.ToString();
                this.Txt_CreditCardExpiration_Year.Text  = Strings.Right(CreditCard_Expiration.Year.ToString(), 2);
            }
            else
            {
                this.Txt_CreditCardExpiration_Month.Text = "";
                this.Txt_CreditCardExpiration_Year.Text  = "";
            }

            this.Txt_CreditCard_Part1.Text = (string)Do_Methods.IsNull(this.mObj.pDr["CreditCardNo1"], "");
            this.Txt_CreditCard_Part2.Text = (string)Do_Methods.IsNull(this.mObj.pDr["CreditCardNo2"], "");
            this.Txt_CreditCard_Part3.Text = (string)Do_Methods.IsNull(this.mObj.pDr["CreditCardNo3"], "");
            this.Txt_CreditCard_Part4.Text = (string)Do_Methods.IsNull(this.mObj.pDr["CreditCardNo4"], "");
            this.Chk_IsCreditHold.Checked  = (bool)Do_Methods.IsNull(this.mObj.pDr["IsCreditHold"], false);

            this.Lbl_PST_Value.Text = Strings.Format(Do_Methods.IsNull(this.mObj.pDr["PST_Value"], 0), "#,##0.00");
            this.Lbl_HST_Value.Text = Strings.Format(Do_Methods.IsNull(this.mObj.pDr["HST_Value"], 0), "#,##0.00");
            this.Lbl_GST_Value.Text = Strings.Format(Do_Methods.IsNull(this.mObj.pDr["GST_Value"], 0), "#,##0.00");

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

            this.Cbo_Currency.SelectedValue    = Convert.ToInt64(Do_Methods.IsNull(this.mObj.pDr["LookupID_Currency"], this.SetupPage_GetLookupDefault(Dt_Defaults, Layer01_Common.Common.Layer01_Constants.eLookup.Currency))).ToString();
            this.Cbo_PaymentTerm.SelectedValue = Convert.ToInt64(Do_Methods.IsNull(this.mObj.pDr["LookupID_PaymentTerm"], this.SetupPage_GetLookupDefault(Dt_Defaults, Layer01_Common.Common.Layer01_Constants.eLookup.PaymentTerm))).ToString();
            this.Cbo_TaxCode.SelectedValue     = Convert.ToInt64(Do_Methods.IsNull(this.mObj.pDr["LookupTaxCodeID"], 0)).ToString();
            this.Cbo_ClientType.SelectedValue  = Convert.ToInt64(Do_Methods.IsNull(this.mObj.pDr["LookupClientTypeID"], this.SetupPage_GetLookupDefault(Dt_Defaults, Layer01_Common.Common.Layer01_Constants.eLookup.ClientType))).ToString();

            this.UcPerson.Setup(this.mObj.pObj_Person);
            this.UcAddress.Setup(this.mObj.pObj_Address);

            this.UcGrid_ShippingAddress.Setup(
                "Customer_ShippingAddress"
                , this.mObj.pDt_ShippingAddress
                , "TmpKey"
                , false
                , true
                , this.mMaster.pIsReadOnly);
            this.UcGrid_ShippingAddress.pGrid.ClientSideOnItemCommand = "EOGrid_ItemCommand";
        }
Пример #8
0
        private void LoadMenu()
        {
            ClsSysCurrentUser CurrentUser = this.mMaster.pCurrentUser;
            DataTable         Dt_Menu;

            if (CurrentUser.pIsAdmin)
            {
                Dt_Menu = Do_Methods_Query.GetQuery("uvw_System_Modules", "", "IsNull(IsHidden,0) = 0", "Parent_OrderIndex, OrderIndex");
            }
            else
            {
                List <QueryParameter> Sp = new List <QueryParameter>();
                Sp.Add(new QueryParameter(@"@UserID", CurrentUser.pDrUser["UserID"]));
                Dt_Menu = Do_Methods_Query.ExecuteQuery("usp_System_Modules_Load", Sp).Tables[0];
            }

            this.trvMenus.Nodes.Clear();

            foreach (DataRow Dr in Dt_Menu.Rows)
            {
                if ((Int64)Do_Methods.IsNull(Dr["Parent_System_ModulesID"], 0) == 0)
                {
                    TreeNode Node = new TreeNode();
                    Node.Text = @"&nbsp" + Dr["Name"];
                    //Node.ImageUrl = "";
                    if ((string)Do_Methods.IsNull(Dr["PageUrl_List"], "") != "")
                    {
                        string Arguments = (string)Do_Methods.IsNull(Dr["Arguments"], "");
                        if (Arguments != "")
                        {
                            Arguments = @"?" + Arguments;
                        }
                        Node.NavigateUrl = @"~/" + Dr["PageUrl_List"] + Arguments;
                    }
                    else
                    {
                        Node.SelectAction = TreeNodeSelectAction.None;
                    }

                    this.trvMenus.Nodes.Add(Node);

                    DataRow[] ArrDr = Dt_Menu.Select("Parent_System_ModulesID = " + ((Int64)Do_Methods.IsNull(Dr["System_ModulesID"], 0)).ToString());
                    if (ArrDr.Length > 0)
                    {
                        this.AddNode(ref Dt_Menu, Node, (Int64)Do_Methods.IsNull(Dr["System_ModulesID"], 0));
                    }
                }
            }
        }
Пример #9
0
        string Details_SelectEmployee(Int64 ID)
        {
            this.mObj.pDr["EmployeeID_SalesPerson"] = ID;

            System.Text.StringBuilder Sb_Js = new System.Text.StringBuilder();
            DataTable Dt = Do_Methods_Query.GetQuery("uvw_Employee", "", "EmployeeID = " + ID.ToString());

            if (Dt.Rows.Count > 0)
            {
                this.Lbl_SalesPerson.Text = (string)Do_Methods.IsNull(Dt.Rows[0]["EmployeeCodeName"], "");
                Layer01_Methods_Web.Eval_AppendJs(this.Server, ref Sb_Js, this.Lbl_SalesPerson.ClientID, "innerHTML", this.Lbl_SalesPerson.Text);
            }

            return(Sb_Js.ToString());
        }
        public override void SetupPage()
        {
            if (this.CheckIsSetup())
            {
                return;
            }

            string ModuleName = (string)this.ViewState[CnsModuleName];

            if (ModuleName == "")
            {
                DataTable Dt = Do_Methods_Query.GetQuery("System_Modules", "", "System_ModulesID = " + this.mSystem_ModulesID);
                if (Dt.Rows.Count > 0)
                {
                    ModuleName = (string)Do_Methods.IsNull(Dt.Rows[0]["Name"], "") + " Details";
                }
            }

            this.Lbl_ModuleName.Text = ModuleName;

            if (
                (!this.mCurrentUser.CheckAccess(this.mSystem_ModulesID, Layer01_Common.Common.Layer01_Constants.eAccessLib.eAccessLib_New)) &&
                (this.mObj_Base.pKey == null))
            {
                throw new Exception("You have no access in this page.");
            }
            else if (
                (!this.mCurrentUser.CheckAccess(this.mSystem_ModulesID, Layer01_Common.Common.Layer01_Constants.eAccessLib.eAccessLib_New)) ||
                (!this.mCurrentUser.CheckAccess(this.mSystem_ModulesID, Layer01_Common.Common.Layer01_Constants.eAccessLib.eAccessLib_Edit)) ||
                (!this.mCurrentUser.CheckAccess(this.mSystem_ModulesID, Layer01_Common.Common.Layer01_Constants.eAccessLib.eAccessLib_View)))
            {
                throw new Exception("You have no access in this page.");
            }

            this.pIsReadOnly = true;
            if (
                this.mCurrentUser.CheckAccess(this.mSystem_ModulesID, Layer01_Common.Common.Layer01_Constants.eAccessLib.eAccessLib_New) &&
                this.mCurrentUser.CheckAccess(this.mSystem_ModulesID, Layer01_Common.Common.Layer01_Constants.eAccessLib.eAccessLib_Edit))
            {
                this.pIsReadOnly = false;
            }

            this.Btn_Save.Enabled  = !this.pIsReadOnly;
            this.Btn_Save2.Enabled = this.Btn_Save.Enabled;
            this.SetupPage_ControlAttributes();
        }
        //[-]

        DataTable List(
            QueryCondition Condition = null
            , string Sort            = ""
            , Int64 Top  = 0
            , Int32 Page = 0)
        {
            DataRow Dr_Bind = Do_Methods_Query.GetSystemBindDefinition(this.mSelectionName);

            string Bind_Desc      = (string)Do_Methods.IsNull(Dr_Bind["Desc"], "");
            string Bind_TableName = (string)Do_Methods.IsNull(Dr_Bind["TableName"], "");
            string Bind_TableKey  = (string)Do_Methods.IsNull(Dr_Bind["TableKey"], "");
            string Bind_Condition = (string)Do_Methods.IsNull(Dr_Bind["Condition"], "");
            string Bind_Sort      = (string)Do_Methods.IsNull(Dr_Bind["Sort"], "");

            string Query_Source    = "";
            string Query_Condition = "";

            if (this.mQuery_Selection != "")
            {
                Query_Condition = this.mQuery_Selection;
            }
            else
            {
                Query_Source = Bind_TableName;
                if (Bind_Condition != "")
                {
                    Query_Condition = "Where " + Bind_Condition;
                }
            }

            if (Query_Source == "")
            {
                throw new Exception("Selection Source not set.");
            }

            if (Sort == "")
            {
                Sort = Bind_Sort;
            }

            string    Query   = @"(Select * From " + Query_Source + " " + Query_Condition + @") As [Tb]";
            DataTable Dt_List = Do_Methods_Query.GetQuery(Query, "", Condition, Sort, Top, Page);

            return(Dt_List);
        }
        public void GetColumns(string Name)
        {
            DataTable Dt =
                Do_Methods_Query.GetQuery(
                    @"udf_System_BindDefinition('" + Name + @"')"
                    , ""
                    , "IsNull(IsHidden,0) = 0"
                    , "OrderIndex");

            foreach (DataRow Dr in Dt.Rows)
            {
                string FieldName    = (string)Do_Methods.IsNull(Dr["Name"], "");
                string FieldDesc    = (string)Do_Methods.IsNull(Dr["Desc"], "");
                string NumberFormat = (string)Do_Methods.IsNull(Dr["NumberFormat"], "");

                if (NumberFormat != "")
                {
                    NumberFormat = NumberFormat.Replace("{", "");
                    NumberFormat = NumberFormat.Replace("}", "");
                    string[] Arr = NumberFormat.Split(':');

                    try
                    { NumberFormat = Arr[1]; }
                    catch { }

                    Regex Reg = new Regex(@"N[0-9]", RegexOptions.IgnoreCase);
                    if (Reg.Match(NumberFormat).Success)
                    {
                        Int32 X = 0;
                        try
                        { X = Convert.ToInt32(NumberFormat.Substring(2, 1)); }
                        catch { }

                        NumberFormat = "#,##0";
                        if (X != 0)
                        {
                            NumberFormat.PadRight(X, '0');
                        }
                    }

                    this.Add(FieldName, FieldDesc, NumberFormat);
                }
            }
        }
Пример #13
0
        public static bool CheckSeriesDuplicate(
            string TableName
            , string SeriesField
            , Keys Keys
            , string SeriesNo)
        {
            bool      Rv = false;
            DataTable Dt;

            StringBuilder Sb_Query_Key = new StringBuilder();
            string        Query_Key    = "";
            string        Query_And    = "";

            if (Keys != null)
            {
                foreach (string Inner_Key in Keys.pName)
                {
                    Sb_Query_Key.Append(Query_And + " " + Inner_Key + " = " + Keys[Inner_Key]);
                    Query_And = " And ";
                }
            }

            Query_Key = " 1 = 1 ";
            if (Sb_Query_Key.ToString() != "")
            {
                Query_Key = "(Not (" + Sb_Query_Key.ToString() + "))";
            }

            Dt = Do_Methods_Query.GetQuery(
                "[" + TableName + "]"
                , "Count(1) As [Ct]"
                , Query_Key + " And " + SeriesField + " = '" + SeriesNo + "'");
            if (Dt.Rows.Count > 0)
            {
                if (Do_Methods.Convert_Int64(Dt.Rows[0][0]) > 0)
                {
                    Rv = true;
                }
            }

            //True means duplicates have been found
            return(Rv);
        }
        Int64 List_Count(QueryCondition Condition = null)
        {
            DataRow Dr_Bind = Do_Methods_Query.GetSystemBindDefinition(this.mSelectionName);

            string Bind_Desc      = (string)Do_Methods.IsNull(Dr_Bind["Desc"], "");
            string Bind_TableName = (string)Do_Methods.IsNull(Dr_Bind["TableName"], "");
            string Bind_TableKey  = (string)Do_Methods.IsNull(Dr_Bind["TableKey"], "");
            string Bind_Condition = (string)Do_Methods.IsNull(Dr_Bind["Condition"], "");
            string Bind_Sort      = (string)Do_Methods.IsNull(Dr_Bind["Sort"], "");

            string Query_Source    = "";
            string Query_Condition = "";

            if (this.mQuery_Selection != "")
            {
                Query_Condition = this.mQuery_Selection;
            }
            else
            {
                Query_Source = Bind_TableName;
                if (Bind_Condition != "")
                {
                    Query_Condition = "Where " + Bind_Condition;
                }
            }

            if (Query_Source == "")
            {
                throw new Exception("Selection Source not set.");
            }

            string    Query   = @"(Select * From " + Query_Source + " " + Query_Condition + @") As [Tb]";
            DataTable Dt_List = Do_Methods_Query.GetQuery(Query, "Count(1) As [Ct]", Condition);

            Int64 Rv = 0;

            try
            { Rv = Convert.ToInt64(Do_Methods.IsNull(Dt_List.Rows[0]["Ct"], 0)); }
            catch { }

            return(Rv);
        }
Пример #15
0
 void SetupPage_Lookups()
 {
     Layer01_Methods_Web.BindCombo(ref this.Cbo_Currency, Do_Methods_Query.GetLookup("Currency"), "LookupID", "Desc", 0, "-Select-");
     Layer01_Methods_Web.BindCombo(ref this.Cbo_PaymentTerm, Do_Methods_Query.GetLookup("PaymentTerm"), "LookupID", "Desc", 0, "-Select-");
     Layer01_Methods_Web.BindCombo(ref this.Cbo_ShipVia, Do_Methods_Query.GetLookup("ShipVia"), "LookupID", "Desc", 0, "-Select-");
     Layer01_Methods_Web.BindCombo(
         ref this.Cbo_TaxCode
         , Do_Methods_Query.GetQuery("LookupTaxCode", "", "IsNull(IsDeleted,0) = 0 And IsNull(IsActive,0) = 1")
         , "LookupTaxCodeID"
         , "Desc"
         , 0
         , "-Select-");
     Layer01_Methods_Web.BindCombo(
         ref this.Cbo_ClientType
         , Do_Methods_Query.GetQuery("LookupClientType", "", "IsNull(IsDeleted,0) = 0 And IsNull(IsActive,0) = 1")
         , "LookupClientTypeID"
         , "Desc"
         , 0
         , "-Select-");
 }
Пример #16
0
        string Details_TaxCode()
        {
            System.Text.StringBuilder Sb_Js = new System.Text.StringBuilder();
            Int64 LookupTaxCodeID           = 0;

            try
            { LookupTaxCodeID = Convert.ToInt64(this.Cbo_TaxCode.SelectedValue); }
            catch { }

            DataTable Dt = Do_Methods_Query.GetQuery("LookupTaxCode", "", "LookupTaxCodeID = " + LookupTaxCodeID);

            if (Dt.Rows.Count > 0)
            {
                DataRow Dr = Dt.Rows[0];
                Layer01_Methods_Web.Eval_AppendJs(this.Server, ref Sb_Js, this.Lbl_PST_Value.ClientID, "innerHTML", Strings.Format(Do_Methods.IsNull(Dr["PST_Value"], 0), "#,##0.00"));
                Layer01_Methods_Web.Eval_AppendJs(this.Server, ref Sb_Js, this.Lbl_GST_Value.ClientID, "innerHTML", Strings.Format(Do_Methods.IsNull(Dr["GST_Value"], 0), "#,##0.00"));
                Layer01_Methods_Web.Eval_AppendJs(this.Server, ref Sb_Js, this.Lbl_HST_Value.ClientID, "innerHTML", Strings.Format(Do_Methods.IsNull(Dr["HST_Value"], 0), "#,##0.00"));
            }
            return(Sb_Js.ToString());
        }
        public void Save_ReloadPage()
        {
            this.Session.Remove(this.mObjID);

            Collection PageCollection = new Collection();

            PageCollection.Add(true, "IsSave");

            this.Session[Layer01_Constants_Web.CnsSession_TmpObj] = PageCollection;
            this.Session[Layer01_Constants_Web.CnsSession_Keys]   = this.mObj_Base.GetKeys();

            DataTable Dt  = Do_Methods_Query.GetQuery("System_Modules", "", "System_ModulesID = " + this.mSystem_ModulesID.ToString());
            string    Url = "";

            if (Dt.Rows.Count > 0)
            {
                Url = "~/" + (string)Do_Methods.IsNull(Dt.Rows[0]["PageUrl_Details"], "");
            }

            this.Response.Redirect(Url);
        }
Пример #18
0
        //[-]

        protected string Details_PrepareNew()
        {
            DataTable Dt  = Do_Methods_Query.GetQuery("System_Modules", "", "System_ModulesID = " + this.mSystem_ModulesID.ToString());
            string    Url = "";

            if (Dt.Rows.Count > 0)
            {
                Url = "~/" + (string)Do_Methods.IsNull(Dt.Rows[0]["PageUrl_Details"], "");
            }

            string Override_PageUrl_Details_New = (string)this.ViewState[CnsOverride_PageUrl_Details_New];

            if (Override_PageUrl_Details_New != "")
            {
                Url = Override_PageUrl_Details_New;
            }

            this.Session[Layer01_Constants_Web.CnsSession_Keys] = null;

            return(Url);
        }
Пример #19
0
        protected string Details_PrepareOpen(Int64 ID)
        {
            DataTable Dt  = Do_Methods_Query.GetQuery("System_Modules", "", "System_ModulesID = " + this.mSystem_ModulesID.ToString());
            string    Url = "";

            if (Dt.Rows.Count > 0)
            {
                Url = "~/" + (string)Do_Methods.IsNull(Dt.Rows[0]["PageUrl_Details"], "");
            }

            this.Session[Layer01_Constants_Web.CnsSession_Keys] = null;

            QueryCondition Qc = new QueryCondition();

            Qc.Add(this.mObj_Base.pHeader_TableKey, "=", ID, typeof(Int64).ToString());
            Dt = this.List(Qc);
            if (Dt.Rows.Count > 0)
            {
                this.Session[Layer01_Constants_Web.CnsSession_Keys] = this.mObj_Base.GetKeys(Dt.Rows[0]);
            }

            return(Url);
        }
Пример #20
0
        public static string GetSeriesNo(string Name)
        {
            string    Rv = "";
            DataTable Dt;
            string    TableName;
            string    FieldName;
            string    Prefix;
            Int32     Digits;

            Dt = Do_Methods_Query.GetQuery("System_DocumentSeries", "", "ModuleName = '" + Name + "'");
            if (Dt.Rows.Count > 0)
            {
                TableName = (string)Do_Methods.IsNull(Dt.Rows[0]["TableName"], "");
                FieldName = (string)Do_Methods.IsNull(Dt.Rows[0]["FieldName"], "");
                Prefix    = (string)Do_Methods.IsNull(Dt.Rows[0]["Prefix"], "");
                Digits    = (Int32)Do_Methods.IsNull(Dt.Rows[0]["Digits"], "");
            }
            else
            {
                return(Rv);
            }

            List <QueryParameter> Sp = new List <QueryParameter>();

            Sp.Add(new QueryParameter("@TableName", TableName));
            Sp.Add(new QueryParameter("@FieldName", FieldName));
            Sp.Add(new QueryParameter("@Prefix", Prefix));
            Sp.Add(new QueryParameter("@Digits", Digits));

            Dt = Do_Methods_Query.ExecuteQuery("usp_GetSeriesNo", Sp).Tables[0];
            if (Dt.Rows.Count > 0)
            {
                Rv = (string)Dt.Rows[0][0];
            }

            return(Rv);
        }
Пример #21
0
        public override bool Save(Interface_DataAccess Da = null)
        {
            if (this.mIsCache)
            {
                DataTable Dt_Tub = Do_Methods_Query.GetQuery(@"System_TableUpdateBatch", "", @"TableName = '" + this.mHeader_TableName + @"'");
                DataRow   Dr_Tub = null;
                if (Dt_Tub.Rows.Count > 0)
                {
                    Dr_Tub = Dt_Tub.Rows[0];
                }
                else
                {
                    throw new Exception("Table Cache info not found.");
                }

                List <QueryParameter> List_Qp = new List <QueryParameter>();
                List_Qp.Add(new QueryParameter("TableUpdateBatchID", Do_Methods.Convert_Int64(Dr_Tub["System_TableUpdateBatchID"])));
                List_Qp.Add(new QueryParameter("ID", this.pID));

                Do_Methods_Query.ExecuteNonQuery("usp_InsertToTableUpdateBatch", List_Qp);
            }

            return(base.Save(Da));
        }
        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;
        }
Пример #23
0
        bool Save_Validation(ref System.Text.StringBuilder Sb_Msg)
        {
            WebControl Wc;
            bool       IsValid = true;

            this.Txt_Code.CssClass = Layer01_Constants_Web.CnsCssTextbox;
            if (this.Txt_Code.Text.Trim() == "")
            {
                this.Txt_Code.Text = Layer02_Common.GetSeriesNo("Customer");
            }

            Wc = this.Txt_Code;
            Layer01_Methods_Web.Save_Validation(
                ref Sb_Msg
                , ref Wc
                , ref IsValid
                , Layer01_Constants_Web.CnsCssTextbox
                , Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight
                , Layer02_Common.CheckSeriesDuplicate("uvw_Customer", "CustomerCode", this.mObj.GetKeys(), this.Txt_Code.Text)
                , "Duplicate Customer ID found. Please change the Customer ID. <br />");

            Int64     LookupClientTypeID = Convert.ToInt64(Do_Methods.IsNull(this.mObj.pDr["LookupClientTypeID"], 0));
            DataTable Dt = Do_Methods_Query.GetQuery("LookupClientType", "", "LookupClientTypeID = " + LookupClientTypeID.ToString());

            if (Dt.Rows.Count > 0)
            {
                DataRow Dr_ClientType = Dt.Rows[0];

                if ((bool)Do_Methods.IsNull(Dr_ClientType["IsCurrency"], false))
                {
                    Wc = this.Cbo_Currency;
                    Layer01_Methods_Web.Save_Validation(
                        ref Sb_Msg
                        , ref Wc
                        , ref IsValid
                        , Layer01_Constants_Web.CnsCssTextbox
                        , Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight
                        , (Convert.ToInt64(this.Cbo_Currency.SelectedValue) == 0)
                        , "Currency is required. <br />");
                }

                if ((bool)Do_Methods.IsNull(Dr_ClientType["IsCreditCard_AccountName"], false))
                {
                    Wc = this.Txt_CreditCard_AccountName;
                    Layer01_Methods_Web.Save_Validation(
                        ref Sb_Msg
                        , ref Wc
                        , ref IsValid
                        , Layer01_Constants_Web.CnsCssTextbox
                        , Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight
                        , (this.Txt_CreditCard_AccountName.Text == "")
                        , "Account Name is required. <br />");
                }

                if ((bool)Do_Methods.IsNull(Dr_ClientType["IsCreditCard"], false))
                {
                    bool Inner_IsValid = true;
                    this.Txt_CreditCard_Part1.CssClass = Layer01_Constants_Web.CnsCssTextbox;
                    this.Txt_CreditCard_Part2.CssClass = Layer01_Constants_Web.CnsCssTextbox;
                    this.Txt_CreditCard_Part3.CssClass = Layer01_Constants_Web.CnsCssTextbox;
                    this.Txt_CreditCard_Part4.CssClass = Layer01_Constants_Web.CnsCssTextbox;

                    if (this.Txt_CreditCard_Part1.Text.Trim() == "")
                    {
                        Inner_IsValid = false;
                    }
                    if (this.Txt_CreditCard_Part2.Text.Trim() == "")
                    {
                        Inner_IsValid = false;
                    }
                    if (this.Txt_CreditCard_Part3.Text.Trim() == "")
                    {
                        Inner_IsValid = false;
                    }
                    if (this.Txt_CreditCard_Part4.Text.Trim() == "")
                    {
                        Inner_IsValid = false;
                    }

                    if (!Inner_IsValid)
                    {
                        IsValid = false;
                        this.Txt_CreditCard_Part1.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight;
                        this.Txt_CreditCard_Part2.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight;
                        this.Txt_CreditCard_Part3.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight;
                        this.Txt_CreditCard_Part4.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight;
                        Sb_Msg.Append("Credit Card is required. <br />");
                    }
                }


                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 { }

                this.Txt_CreditCardExpiration_Month.CssClass = Layer01_Constants_Web.CnsCssTextbox;
                this.Txt_CreditCardExpiration_Year.CssClass  = Layer01_Constants_Web.CnsCssTextbox;

                if (!
                    (this.Txt_CreditCardExpiration_Month.Text.Trim() == "" ||
                     this.Txt_CreditCardExpiration_Year.Text.Trim() == ""))
                {
                    DateTime Inner_DateTime;
                    try
                    {
                        Inner_DateTime = new DateTime(CreditCardExpiration_Year, CreditCardExpiration_Month, 1);
                        if (Inner_DateTime < DateTime.Now)
                        {
                            IsValid = false;
                            this.Txt_CreditCardExpiration_Month.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight;
                            this.Txt_CreditCardExpiration_Year.CssClass  = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight;
                            Sb_Msg.Append("Credit Card Date Expiry must be earlier than today. <br />");
                        }
                    }
                    catch
                    {
                        IsValid = false;
                        this.Txt_CreditCardExpiration_Month.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight;
                        this.Txt_CreditCardExpiration_Year.CssClass  = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight;
                        Sb_Msg.Append("Credit Card Date Expiry is incorrect. <br />");
                    }
                }

                if ((bool)Do_Methods.IsNull(Dr_ClientType["IsCreditCard_Expiration"], false))
                {
                    if (this.Txt_CreditCardExpiration_Month.Text.Trim() == "" ||
                        this.Txt_CreditCardExpiration_Year.Text.Trim() == "")
                    {
                        IsValid = false;
                        this.Txt_CreditCardExpiration_Month.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight;
                        this.Txt_CreditCardExpiration_Year.CssClass  = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight;
                        Sb_Msg.Append("Credit Card Date Expiry is required. <br />");
                    }
                }

                if ((bool)Do_Methods.IsNull(Dr_ClientType["IsPaymentTerm"], false))
                {
                    Wc = this.Cbo_PaymentTerm;
                    Layer01_Methods_Web.Save_Validation(
                        ref Sb_Msg
                        , ref Wc
                        , ref IsValid
                        , Layer01_Constants_Web.CnsCssTextbox
                        , Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight
                        , (Convert.ToInt64(this.Cbo_PaymentTerm.SelectedValue) == 0)
                        , "Payment Term is required. <br />");
                }

                if ((bool)Do_Methods.IsNull(Dr_ClientType["IsTaxCode"], false))
                {
                    Wc = this.Cbo_TaxCode;
                    Layer01_Methods_Web.Save_Validation(
                        ref Sb_Msg
                        , ref Wc
                        , ref IsValid
                        , Layer01_Constants_Web.CnsCssTextbox
                        , Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight
                        , (Convert.ToInt64(this.Cbo_TaxCode.SelectedValue) == 0)
                        , "Tax Code is required. <br />");
                }
            }

            return(IsValid);
        }