Ejemplo n.º 1
0
        public ClsKeys GetKeys(DataRow Dr, List <string> KeyNames)
        {
            bool    IsFound = false;
            ClsKeys Key     = new ClsKeys();

            foreach (string Inner_Key in KeyNames)
            {
                if (!Information.IsDBNull(Dr[Inner_Key]))
                {
                    Key.Add(Inner_Key, (Int64)Methods.IsNull(Dr[Inner_Key], 0));
                }
                else
                {
                    IsFound = true;
                    break;
                }
            }

            if (IsFound)
            {
                Key = null;
            }

            return(Key);
        }
Ejemplo n.º 2
0
        public override void Load(ClsKeys Keys = null)
        {
            base.Load(Keys);

            DataTable Dt;
            if (Keys == null)
            {
                List<Do_Constants.Str_Parameters> Sp = new List<Do_Constants.Str_Parameters>();
                Sp.Add(new Do_Constants.Str_Parameters("@ID", 0));
                Dt = Do_Methods_Query.ExecuteQuery("usp_User_Rights_Load", Sp).Tables[0];
            }
            else
            {
                Int64 ID = 0;
                try
                { ID = Keys["UserID"]; }
                catch { }
                List<Do_Constants.Str_Parameters> Sp = new List<Do_Constants.Str_Parameters>();
                Sp.Add(new Do_Constants.Str_Parameters("@ID", ID));
                Dt = Do_Methods_Query.ExecuteQuery("usp_User_Rights_Load", Sp).Tables[0];
            }

            this.AddRequired(Dt);
            this.pTableDetail_Set("User_Rights", Dt);
        }
Ejemplo n.º 3
0
        public override void Load(ClsKeys Keys = null)
        {
            base.Load(Keys);

            List<string> KeyNames = new List<string>();
            KeyNames.Add("DocumentID");
            Keys = this.GetKeys(this.pDr, KeyNames);
            this.mObj_Document.Load(Keys);
        }
Ejemplo n.º 4
0
        public ClsKeys GetKeys(DataRow Dr)
        {
            ClsKeys Obj = new ClsKeys();

            foreach (string Key in this.mHeader_Key)
            {
                Int64 ID = (Int64)Methods.IsNull(Dr[Key], 0);
                Obj.Add(Key, ID);
            }
            return(Obj);
        }
Ejemplo n.º 5
0
        //[-]

        public ClsKeys GetKeys()
        {
            ClsKeys Obj = new ClsKeys();

            foreach (string Key in this.mHeader_Key)
            {
                Int64 ID = Convert.ToInt64(Methods.IsNull(this.mHeader_Dr[Key], 0));
                Obj.Add(Key, ID);
            }
            return(Obj);
        }
Ejemplo n.º 6
0
        public override void Load(ClsKeys Keys = null)
        {
            base.Load(Keys);

            //[-]

            //foreach (DataRow Dr in this.pDt_ContactPerson.Rows)
            //{
            //    ClsPerson Inner_Obj = new ClsPerson(this.mCurrentUser);
            //    ClsKeys Inner_Keys = null;
            //    Int64 Inner_PersonID = Convert.ToInt64(Do_Methods.IsNull(Dr["PersonID"], 0));

            //    if (Inner_PersonID != 0)
            //    {
            //        Inner_Keys = new ClsKeys();
            //        Inner_Keys.Add("PersonID", Inner_PersonID);
            //    }

            //    Inner_Obj.Load(Inner_Keys);
            //    this.mBO_Details_Person.Add(Convert.ToInt64(Do_Methods.IsNull(Dr["TmpKey"], 0)).ToString(), Inner_Obj);
            //}
        }
        public static bool CheckSeriesDuplicate(
            string TableName
            , string SeriesField
            , ClsKeys Keys
            , string SeriesNo)
        {
            bool Rv = false;
            DataTable Dt;

            System.Text.StringBuilder Sb_Query_Key = new StringBuilder();
            string Query_Key = "";
            string Query_And = "";

            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 ((Int32)Dt.Rows[0][0] > 0)
                { Rv = true; }
            }

            //True means duplicates have been found
            return Rv;
        }
Ejemplo n.º 8
0
        public override void Load(ClsKeys Keys = null)
        {
            base.Load(Keys);

            //[-]

            Int64 ContactPersonID = Convert.ToInt64(Do_Methods.IsNull(this.pDr["ContactPersonID"], 0));

            if (ContactPersonID != 0)
            {
                Keys = new ClsKeys();
                Keys.Add("ContactPersonID", ContactPersonID);
            }
            else
            { Keys = null; }

            this.mObj_ContactPerson.Load(Keys);

            //this.mObj_ShippingAddress.Load(Keys, this);

            //[-]

            //foreach (DataRow Dr in this.pDt_ShippingAddress.Rows)
            //{
            //    ClsAddress Inner_Obj = new ClsAddress(this.mCurrentUser);
            //    ClsKeys Inner_Keys = null;
            //    Int64 Inner_ID = Convert.ToInt64(Do_Methods.IsNull(Dr["AddressID"], 0));
            //    if (Inner_ID != 0)
            //    {
            //        Inner_Keys = new ClsKeys();
            //        Inner_Keys.Add("AddressID", Inner_ID);
            //    }
            //    Inner_Obj.Load(Inner_Keys);
            //    this.mBO_ShippingAddress_Address.Add(Convert.ToInt64(Do_Methods.IsNull(Dr["TmpKey"], 0)).ToString(), Inner_Obj);
            //}
        }
Ejemplo n.º 9
0
        //[-]

        public virtual void Load(ClsKeys Keys = null)
        {
            ClsDataAccess Da           = new ClsDataAccess();
            StringBuilder Sb_Condition = new StringBuilder();
            string        Condition    = "";

            try
            {
                if (Keys != null)
                {
                    if (Keys.Count() != this.mHeader_Key.Count)
                    {
                        throw new Exception("Keys not equal to required keys.");
                    }

                    string Inner_Condition_And = "";
                    bool   IsStart             = false;
                    foreach (string Inner_Key in this.mHeader_Key)
                    {
                        Sb_Condition.Append(Inner_Condition_And + " " + Inner_Key + " = " + Keys[Inner_Key]);
                        if (!IsStart)
                        {
                            Inner_Condition_And = " And ";
                        }
                        IsStart = true;
                    }
                }

                Condition = Sb_Condition.ToString();

                Da.Connect();

                DataTable Dt;
                DataRow   Dr;

                if (Keys == null)
                {
                    Dt = Methods_Query.GetQuery(Da, this.mHeader_ViewName, "*", "1 = 0");
                    Dr = Dt.NewRow();
                }
                else
                {
                    Dt = Methods_Query.GetQuery(Da, this.mHeader_ViewName, "*", Condition);
                    Dr = Dt.Rows[0];
                }

                this.mHeader_Dr = Dr;

                //[-]

                if (this.mBase_TableDetail != null)
                {
                    foreach (ClsBaseTableDetail Inner_Obj in this.mBase_TableDetail)
                    {
                        Inner_Obj.Load(Da, Condition);
                    }
                }

                //[-]

                if (this.mBase_RowDetail != null)
                {
                    foreach (ClsBaseRowDetail Inner_Obj in this.mBase_RowDetail)
                    {
                        Inner_Obj.Load(Da, Condition);
                    }
                }

                //[-]

                this.AddRequired();
            }
            catch { }
        }