Пример #1
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();
        }
Пример #2
0
        void SetupPage()
        {
            this.Txt_Name.Text = (string)Do_Methods.IsNull(this.mObj.pDr_RowProperty["Name"], "");
            this.Txt_Desc.Text = (string)Do_Methods.IsNull(this.mObj.pDr_RowProperty["Remarks"], "");

            this.BindGrid_Details();
        }
Пример #3
0
        void Details_FormatPhoneNo(ref TextBox TextBox)
        {
            System.Text.RegularExpressions.MatchCollection Matches = System.Text.RegularExpressions.Regex.Matches(TextBox.Text, "[0-9]");
            TextBox.Text = "";
            System.Text.StringBuilder Sb = new System.Text.StringBuilder();
            foreach (System.Text.RegularExpressions.Match Match in Matches)
            {
                Sb.Append(Match.Value);
            }
            string Formatted = "";

            Formatted = Sb.ToString();

            Sb.Clear();
            try
            { Sb.Append("(" + Do_Methods.TextFiller(Strings.Mid(Formatted, 1, 3), "0", 3) + ")"); }
            catch { }
            try
            { Sb.Append("-" + Do_Methods.TextFiller(Strings.Mid(Formatted, 4, 3), "0", 3) + ""); }
            catch { }
            try
            { Sb.Append("-" + Do_Methods.TextFiller(Strings.Mid(Formatted, 7, 4), "0", 3) + ""); }
            catch { }

            TextBox.Text = Sb.ToString();
        }
Пример #4
0
        protected Int64 List_Count(QueryCondition Condition = null)
        {
            DataRow Dr_Bind        = Do_Methods_Query.GetSystemBindDefinition(this.mSystem_BinDefinition_Name);
            string  Bind_Condition = (string)Do_Methods.IsNull(Dr_Bind["Condition"], "");
            string  Bind_Sort      = (string)Do_Methods.IsNull(Dr_Bind["Sort"], "");

            string Query_Condition = "";

            if (Bind_Condition.Trim() != "")
            {
                Query_Condition = " Where " + Bind_Condition;
            }

            string Source = (string)this.ViewState[CnsSource];

            if (Source == "")
            {
                Source = this.mObj_Base.pHeader_ViewName;
            }

            string Query = @"(Select * From " + Source + " " + Query_Condition + " ) As [Tb]";

            Interface_DataAccess Da = this.mObj_Base.CreateDataAccess();
            //DataTable Dt = Do_Methods_Query.GetQuery(Query, "Count(1) As [Ct]", Condition);
            DataTable Dt = Da.GetQuery(Query, "Count(1) As [Ct]", Condition);

            Int64 Rv = 0;

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

            return(Rv);
        }
Пример #5
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);
        }
        void EOCb_Accept_Execute(object sender, EO.Web.CallbackEventArgs e)
        {
            if (this.mIsMultipleSelect)
            {
                this.PostGrid_Selected();
            }
            else
            {
                Int64 ID = 0;
                try
                { ID = Convert.ToInt64(e.Parameter); }
                catch { }

                DataTable Inner_Dt = new DataTable();
                Inner_Dt.Columns.Add("ID", typeof(Int64));

                List <QueryParameter> Sp = new List <QueryParameter>();
                Sp.Add(new QueryParameter("ID", ID));
                Do_Methods.AddDataRow(ref Inner_Dt, Sp);
                this.mDt_Selected = Inner_Dt;
            }

            DataTable Dt   = this.Selected();
            string    Data = (string)this.ViewState[CnsData];

            if (EvAccept != null)
            {
                EvAccept(Dt, e, Data);
            }
        }
Пример #8
0
        void SetupPage()
        {
            this.SetupPage_ControlAttributes();

            ClsPerson Obj = this.mObj_Person;

            this.Txt_FirstName.Text  = (string)Do_Methods.IsNull(Obj.pDr["FirstName"], "");
            this.Txt_MiddleName.Text = (string)Do_Methods.IsNull(Obj.pDr["MiddleName"], "");
            this.Txt_LastName.Text   = (string)Do_Methods.IsNull(Obj.pDr["LastName"], "");

            this.Txt_Phone.Text      = (string)Do_Methods.IsNull(Obj.pDr["Phone"], "");
            this.Txt_Mobile.Text     = (string)Do_Methods.IsNull(Obj.pDr["Mobile"], "");
            this.Txt_Fax.Text        = (string)Do_Methods.IsNull(Obj.pDr["Fax"], "");
            this.Txt_Email.Text      = (string)Do_Methods.IsNull(Obj.pDr["Email"], "");
            this.Txt_Email_Work.Text = (string)Do_Methods.IsNull(Obj.pDr["WorkEmail"], "");

            this.EODtp_BirthDate.VisibleDate = DateTime.Now;
            if (!Microsoft.VisualBasic.Information.IsDBNull(Obj.pDr["BirthDate"]))
            {
                this.EODtp_BirthDate.SelectedDate = (DateTime)Obj.pDr["BirthDate"];
            }
            else
            {
                this.EODtp_BirthDate.SelectedDate = new DateTime();
            }
        }
Пример #9
0
        public void Update()
        {
            ClsPerson Obj = this.mObj_Person;

            Obj.pDr["FirstName"]  = this.Txt_FirstName.Text;
            Obj.pDr["MiddleName"] = this.Txt_MiddleName.Text;
            Obj.pDr["LastName"]   = this.Txt_LastName.Text;

            System.Text.StringBuilder Sb_FullName = new System.Text.StringBuilder();
            Sb_FullName.Append(this.Txt_FirstName.Text);
            Sb_FullName.Append(" ");
            Sb_FullName.Append(this.Txt_MiddleName.Text);
            Sb_FullName.Append(" ");
            Sb_FullName.Append(this.Txt_LastName.Text);

            Obj.pDr["FullName"] = Sb_FullName.ToString();

            this.Details_FormatPhoneNo(ref this.Txt_Phone);
            this.Details_FormatPhoneNo(ref this.Txt_Mobile);
            this.Details_FormatPhoneNo(ref this.Txt_Fax);

            Obj.pDr["Phone"]     = this.Txt_Phone.Text;
            Obj.pDr["Mobile"]    = this.Txt_Mobile.Text;
            Obj.pDr["Fax"]       = this.Txt_Fax.Text;
            Obj.pDr["Email"]     = this.Txt_Email.Text;
            Obj.pDr["WorkEmail"] = this.Txt_Email_Work.Text;

            try
            { Obj.pDr["BirthDate"] = this.EODtp_BirthDate.SelectedDate; }
            catch
            { Obj.pDr["BirthDate"] = DBNull.Value; }

            Do_Methods.ConvertCaps(Obj.pDr);
        }
        void BindGrid_Details()
        {
            this.UcGrid_Details.Setup("User_Rights", this.mObj.pDt_Rights, "TmpKey", true);

            //[-]

            DataTable Dt_FilterFields = new DataTable();

            Dt_FilterFields.Columns.Add("Desc", typeof(string));
            Dt_FilterFields.Columns.Add("Field", typeof(string));
            Dt_FilterFields.Columns.Add("DataType", typeof(string));

            List <ClsBindGridColumn_EO> List_Gc = Layer01_Methods_Web_EO.GetBindGridColumn_EO("User_Rights");

            foreach (ClsBindGridColumn Gc in List_Gc)
            {
                if (Gc.mVisible && Gc.mFieldName != "")
                {
                    List <QueryParameter> Sp = new List <QueryParameter>();
                    Sp.Add(new QueryParameter("Field", Gc.mFieldName));
                    Sp.Add(new QueryParameter("Desc", Gc.mFieldDesc));
                    Sp.Add(new QueryParameter("DataType", this.mObj.pDt_Rights.Columns[Gc.mFieldName].DataType.Name));
                    Do_Methods.AddDataRow(ref Dt_FilterFields, Sp);
                }
            }

            Layer01_Methods_Web.BindCombo(ref this.Cbo_SearchFilter, Dt_FilterFields, "Field", "Desc");
            this.ViewState[CnsDt_FilterFields] = Dt_FilterFields;
        }
        void SetupPage()
        {
            this.Txt_Username.Text = (string)Do_Methods.IsNull(this.mObj.pDr["UserName"], "");
            this.Txt_Employee.Text = (string)Do_Methods.IsNull(this.mObj.pDr["EmployeeName"], "");

            this.BindGrid_Details();
        }
        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);
        }
Пример #13
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);
        }
Пример #14
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(); }
        }
Пример #15
0
        void AddNode(ref DataTable Dt_Menu, TreeNode TvNode, Int64 System_ModulesID)
        {
            DataRow[] ArrDr = Dt_Menu.Select("Parent_System_ModulesID = " + System_ModulesID.ToString());
            foreach (DataRow Dr in ArrDr)
            {
                TreeNode Node = new TreeNode();
                Node.Text = @"&nbsp;" + Dr["Name"];

                if ((string)Do_Methods.IsNull(Dr["PageUrl_List"], "") != "")
                {
                    string Arguments = (string)Do_Methods.IsNull(Dr["Arguments"], "");
                    if (Arguments != "")
                    {
                        Arguments = @"?" + Arguments;
                    }
                    Node.NavigateUrl = @"~/" + (string)Dr["PageUrl_List"] + Arguments;
                }
                else
                {
                    Node.SelectAction = TreeNodeSelectAction.None;
                }

                TvNode.ChildNodes.Add(Node);

                DataRow[] Inner_ArrDr = Dt_Menu.Select("Parent_System_ModulesID = " + ((Int64)Do_Methods.IsNull(Dr["System_ModulesID"], 0)).ToString());
                if (Inner_ArrDr.Length > 0)
                {
                    this.AddNode(ref Dt_Menu, Node, (Int64)Do_Methods.IsNull(Dr["System_ModulesID"], 0));
                }
            }
        }
        //[-]

        void Selection_AddFilter()
        {
            DataTable      Dt_FilterFields = (DataTable)this.ViewState[CnsDt_FilterFields];
            string         FilterSt        = "";
            QueryCondition Qc = (QueryCondition)this.ViewState[CnsObj_QueryCondition];

            if (Qc == null)
            {
                Qc = new QueryCondition();
            }

            DataRow[] ArrDr = Dt_FilterFields.Select("Field = '" + this.Cbo_SearchFilter.SelectedValue + "'");
            if (ArrDr.Length > 0)
            {
                Qc.Add(
                    (string)Do_Methods.IsNull(ArrDr[0]["Field"], "")
                    , this.Txt_Search.Text
                    , (string)Do_Methods.IsNull(ArrDr[0]["DataType"], ""));
                FilterSt = this.Cbo_SearchFilter.SelectedItem.Text + " by " + this.Txt_Search.Text;
            }

            this.ViewState[CnsObj_QueryCondition] = Qc;

            string ViewState_DisplayFilterString = (string)this.ViewState[CnsDisplayFilterString];

            ViewState_DisplayFilterString         += @"<br />" + FilterSt;
            this.ViewState[CnsDisplayFilterString] = ViewState_DisplayFilterString;
        }
        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();
        }
Пример #18
0
        //[-]

        void Handle_Selection(DataTable Dt, EO.Web.CallbackEventArgs e, string Data)
        {
            if (Dt.Rows.Count > 0)
            {
                Int64 ID = Convert.ToInt64(Do_Methods.IsNull(Dt.Rows[0]["ID"], 0));
                e.Data = this.Details_SelectEmployee(ID);
            }
        }
        public void Show_UseQuery(
            string SelectionName
            , string SelectionQuery
            , string SelectionQuery_Key
            , string Title          = ""
            , bool IsMultipleSelect = false
            , string Data           = "")
        {
            this.ViewState[CnsData]                = Data;
            this.ViewState[CnsQuery_Selection]     = @"( " + SelectionQuery + @") As [Tb]";
            this.ViewState[CnsQuery_Selection_Key] = SelectionQuery_Key;
            this.ViewState[CnsObj_QueryCondition]  = null;

            this.mSelectionName       = SelectionName;
            this.mIsMultipleSelect    = IsMultipleSelect;
            this.mQuery_Selection     = (string)this.ViewState[CnsQuery_Selection];
            this.mQuery_Selection_Key = (string)this.ViewState[CnsQuery_Selection_Key];

            this.ViewState[CnsSelectionName]    = SelectionName;
            this.ViewState[CnsIsMultipleSelect] = IsMultipleSelect;
            this.Panel_Check.Visible            = IsMultipleSelect;

            //[-]

            DataTable Dt = new DataTable();

            Dt.Columns.Add("ID", typeof(Int64));
            Dt.Columns.Add("IsSelect", typeof(bool));
            this.mDt_Selected = Dt;
            this.ViewState[CnsDt_Selected] = Dt;

            //[-]

            this.BindGrid();
            this.Lbl_AppliedFilters.Text = this.Details_ItemsCount();

            //[-]

            DataRow Dr_Bind = Do_Methods_Query.GetSystemBindDefinition(SelectionName);

            if (Title == "")
            {
                Title = (string)Do_Methods.IsNull(Dr_Bind["Desc"], "");
            }

            if (Title == "")
            {
                Title = "Select";
            }

            this.EODialog_Selection.HeaderHtml         = Title;
            this.EODialog_Selection.ClientSideOnAccept = "Selection_Accept_" + this.ClientID;
            this.EODialog_Selection.Show();

            try
            { this.EOCbp_EODialog_Selection.Update(); }
            catch { }
        }
        public eLoginResult Login(string UserName, string Password)
        {
            Interface_DataAccess Da = new ClsBase().pDa;

            try
            {
                Da.Connect();

                //Administrator Login
                if (UserName.ToUpper() == "Administrator".ToUpper())
                {
                    string System_Password = Da.GetSystemParameter("Administrator_Password", "Administrator");
                    if (System_Password != "")
                    {
                        string Decrypted_Password = System_Password;
                        if (Decrypted_Password == Password)
                        {
                            this.AdministratorLogin();
                            return(eLoginResult.Administrator);
                        }
                        else
                        {
                            return(eLoginResult.WrongPassword);
                        }
                    }
                    else
                    {
                        throw new CustomException("Administrator Password is not set. Contact your System Administrator.");
                    }
                }

                //User Login
                QueryCondition Qc = new QueryCondition();
                Qc.Add("UserName", UserName, typeof(string).ToString());
                DataTable Dt = Da.GetQuery("uvw_User", "", Qc, "UserID");
                if (Dt.Rows.Count > 0)
                {
                    string Decrypted_Password = (string)Do_Methods.IsNull(Dt.Rows[0]["Password"], "");

                    if (Decrypted_Password == Password)
                    {
                        this.mDrUser = Dt.Rows[0];
                        return(eLoginResult.LoggedIn);
                    }
                    else
                    {
                        return(eLoginResult.WrongPassword);
                    }
                }

                return(eLoginResult.WrongUser);
            }
            catch (Exception ex)
            { throw ex; }
            finally
            { Da.Close(); }
        }
Пример #21
0
        public override void RebindGrid()
        {
            Int64 Top = 0;

            try { Top = Do_Methods.Convert_Int64(this.Txt_Top.Text); }
            catch { }

            Int32 Page = 0;

            try { Page = Do_Methods.Convert_Int32(this.Cbo_Page.SelectedValue); }
            catch { }

            string ViewState_DisplayFilterString = (string)this.ViewState[CnsDisplayFilterString];
            string ViewState_DisplayOrderString  = (string)this.ViewState[CnsDisplayOrderString];

            string ViewState_OrderString = (string)this.ViewState[CnsOrderString];

            QueryCondition Qc = null;

            try { Qc = (QueryCondition)this.ViewState[CnsObj_QueryCondition]; }
            catch { }

            if (Qc == null)
            {
                Qc = new QueryCondition();
            }

            this.Details_SetPaginator(Top, this.List_Count(Qc));

            try
            { this.Cbo_Page.SelectedValue = Page.ToString(); }
            catch
            {
                try
                { Page = Convert.ToInt32(this.Cbo_Page.SelectedValue); }
                catch { }
            }

            DataTable Dt;

            try
            { Dt = this.List(Qc, ViewState_OrderString, Top, Page); }
            catch
            {
                Dt = this.List(Qc, "", Top, Page);
                ViewState_OrderString                 = "";
                ViewState_DisplayOrderString          = "";
                this.ViewState[CnsOrderString]        = ViewState_OrderString;
                this.ViewState[CnsDisplayOrderString] = ViewState_DisplayOrderString;
            }

            this.BindGrid(Dt);

            try
            { this.EOCbp_Grid.Update(); }
            catch { }
        }
Пример #22
0
        List <ClsBindGridColumn_EO> BindGrid(DataTable Dt_List)
        {
            bool IsReadOnly = false;

            if (
                !(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))
                )
            {
                IsReadOnly = true;
            }

            bool IsNoSelect = false;

            try { IsNoSelect = (bool)this.ViewState[CnsIsNoSelect]; }
            catch { }

            if (IsNoSelect)
            {
                IsReadOnly = true;
            }

            DataRow Dr_Bind = Do_Methods_Query.GetSystemBindDefinition(this.mSystem_BinDefinition_Name);
            List <ClsBindGridColumn_EO> List_Gc = Layer01_Methods_Web_EO.GetBindGridColumn_EO(this.mSystem_BinDefinition_Name);

            if (!IsReadOnly)
            {
                ClsBindGridColumn_EO Gc = new ClsBindGridColumn_EO("", "", 50, "", Layer01_Common.Common.Layer01_Constants.eSystem_Lookup_FieldType.FieldType_Button);
                Gc.mCommandName = "Select";
                Gc.mFieldText   = ">>";
                Gc.mButtonType  = ButtonColumnType.LinkButton;
                List_Gc.Insert(0, Gc);
            }

            string TableKey = "";

            if (this.mObj_Base != null)
            {
                TableKey = this.mObj_Base.pHeader_TableKey;
            }
            else
            {
                TableKey = (string)this.ViewState[CnsSourceKey];
                if (TableKey == "")
                {
                    TableKey = (string)Do_Methods.IsNull(Dr_Bind["TableKey"], "");
                }
            }

            this.EOGrid_List.ClientSideOnItemCommand = "EOGrid_ItemCommand";
            this.EOGrid_List.FullRowMode             = true;
            Layer01_Methods_Web_EO.BindEOGrid(ref this.EOGrid_List, Dt_List, List_Gc, TableKey, false, false);
            return(List_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);
        }
        protected Int64 SetupPage_GetLookupDefault(DataTable Dt_Lookup, Layer01_Common.Common.Layer01_Constants.eLookup Lkp)
        {
            Int64 DefaultID = 0;

            DataRow[] ArrDr = Dt_Lookup.Select("LookupID = " + ((Int32)Lkp).ToString());
            if (ArrDr.Length > 0)
            {
                DefaultID = Convert.ToInt64(Do_Methods.IsNull(ArrDr[0]["Lookup_DetailsID_Default"], 0));
            }
            return(DefaultID);
        }
Пример #25
0
        public static void NativeExcel_CreateExcel(
            DataTable Dt
            , ClsExcel_Columns Columns
            , string SaveFileName           = ""
            , Excel.XlFileFormat FileFormat = Excel.XlFileFormat.xlExcel5
            , string Title = "")
        {
            Excel.Application Obj_Excel = new Excel.Application();

            Excel.Workbook  owbook  = Obj_Excel.Workbooks.Add();
            Excel.Worksheet owsheet = owbook.Worksheets.Add();

            Int32 RowCt = 2;
            Int32 ColCt = 1;

            foreach (ClsExcel_Columns.Str_Columns?Obj in Columns.pObj)
            {
                owsheet.Cells[RowCt, ColCt].Value     = Obj.Value.FieldDesc;
                owsheet.Cells[RowCt, ColCt].Font.Bold = true;
                Excel.Range Inner_ExRange =
                    owsheet.Range[
                        Do_Methods.GenerateChr(ColCt)
                        + RowCt.ToString()
                        + ":"
                        + Do_Methods.GenerateChr(ColCt)
                        + (RowCt + Dt.Rows.Count).ToString()];
                Inner_ExRange.NumberFormat = Obj.Value.NumberFormat;
                ColCt++;
            }

            RowCt++;
            ColCt = 1;

            Excel.Range ExRange =
                owsheet.Range[
                    Do_Methods.GenerateChr(ColCt)
                    + RowCt.ToString()
                    + ":"
                    + Do_Methods.GenerateChr(ColCt + Columns.pObj.Count)
                    + (RowCt + Dt.Rows.Count - 1).ToString()];

            ExRange.Value = Do_Methods.ConvertDataTo2DimArray(Dt, Columns.pFieldName);
            owsheet.Range["A1;IV65536"].AutoFit();

            if (SaveFileName == "")
            {
                SaveFileName = "Excel_File";
            }

            owsheet.Range["A1:A1"].Select();
            owbook.SaveAs(SaveFileName, FileFormat);
        }
        //[-]

        List <ClsBindGridColumn_EO> BindGrid(
            DataTable Dt_List
            , eCheck Check = eCheck.None)
        {
            DataRow Dr_Bind = Do_Methods_Query.GetSystemBindDefinition(this.mSelectionName);
            List <ClsBindGridColumn_EO> List_Gc = Layer01_Methods_Web_EO.GetBindGridColumn_EO(this.mSelectionName);

            string Bind_TableKey = (string)Do_Methods.IsNull(Dr_Bind["TableKey"], "");

            string TableKey = (string)this.ViewState[CnsQuery_Selection_Key];

            if (TableKey != "")
            {
                Bind_TableKey = TableKey;
            }

            Dt_List.Columns.Add("IsSelect", typeof(bool));
            ClsBindGridColumn_EO Gc =
                new ClsBindGridColumn_EO(
                    "IsSelect"
                    , "Select?"
                    , 80
                    , ""
                    , Layer01_Common.Common.Layer01_Constants.eSystem_Lookup_FieldType.FieldType_Checkbox
                    , this.mIsMultipleSelect);

            List_Gc.Insert(0, Gc);

            if (Check == eCheck.None)
            {
                foreach (DataRow Dr in this.mDt_Selected.Rows)
                {
                    DataRow[] Inner_ArrDr = Dt_List.Select(Bind_TableKey + " = " + Convert.ToInt64(Dr["ID"]).ToString());
                    if (Inner_ArrDr.Length > 0)
                    {
                        Inner_ArrDr[0]["IsSelect"] = Do_Methods.IsNull(Dr["IsSelect"], false);
                    }
                }
            }
            else
            {
                bool Inner_IsSelect = Check == eCheck.CheckAll;
                foreach (DataRow Dr in Dt_List.Rows)
                {
                    Dr["IsSelect"] = Inner_IsSelect;
                }
            }

            this.EOGrid_Selection.FullRowMode = true;
            Layer01_Methods_Web_EO.BindEOGrid(ref this.EOGrid_Selection, Dt_List, List_Gc, Bind_TableKey, false, false);
            return(List_Gc);
        }
Пример #27
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";
        }
Пример #28
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));
                    }
                }
            }
        }
Пример #29
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 bool Save(DataObjects_Framework.DataAccess.Interface_DataAccess Da = null)
        {
            DateTime ServerDate = Layer02_Common.GetServerDate();

            if (Convert.ToInt64(Do_Methods.IsNull(this.mHeader_Dr[this.mHeader_TableName + "ID"], 0)) == 0)
            {
                this.mHeader_Dr["EmployeeID_CreatedBy"] = this.mCurrentUser.pDrUser["EmployeeID"];
                this.mHeader_Dr["DateCreated"]          = ServerDate;
            }

            this.mHeader_Dr["EmployeeID_UpdatedBy"] = this.mCurrentUser.pDrUser["EmployeeID"];
            this.mHeader_Dr["DateUpdated"]          = ServerDate;

            return(base.Save(Da));
        }