public Form2(ClsKeys Key)
        {
            InitializeComponent();
            this.Load += new EventHandler(Form2_Load);
            this.Btn_Save.Click += new EventHandler(Btn_Save_Click);

            this.Employee = new DataObjects.Employee(null);
            this.Employee.Load(Key);
        }
        /// <summary>
        /// (Overrided) Loads the List with the supplied Key
        /// </summary>
        /// <param name="Keys">
        /// Key object to use
        /// </param>
        public override void Load(ClsKeys Keys = null)
        {
            if (Keys == null)
            { this.New(); }
            else
            {
                ClsQueryCondition Qc = this.mDa.CreateQueryCondition();
                foreach (string KeyName in Keys.pName)
                { Qc.Add(KeyName, Keys[KeyName].ToString(), typeof(Int64).ToString(), "0"); }

                if (this.mQc_LoadCondition != null)
                {
                    foreach (DataObjects_Framework.Objects.ClsQueryCondition.Str_QueryCondition Str_Qc in this.mQc_LoadCondition.pList)
                    { Qc.pList.Add(Str_Qc); }
                }

                this.Load(Qc);
            }
        }
Ejemplo n.º 3
0
        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 = new ClsBase().pDa.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;
        }
 public void Load(Interface_DataAccess Da, ClsKeys Keys)
 {
     this.mDr = Da.Load_RowDetails(this.mViewName, Keys, this.mOtherLoadCondition, this.mList_ForeignKey);
 }
Ejemplo n.º 5
0
        //[-]
        /// <summary>
        /// (Overridable) Loads the Data Object with the supplied Key,
        /// when loading table details, the framework assumes the foreign key field of the table detail is the same the parent table
        /// if not supplied by an explicit foreign key definition
        /// </summary>
        /// <param name="Keys">
        /// Key object to use
        /// </param>
        public virtual void Load(ClsKeys Keys = null)
        {
            try
            {
                this.mDa.Connect();

                //[-]

                this.mHeader_Dr = this.mDa.Load(this.mHeader_ViewName, this.mHeader_Key, Keys);

                //[-]

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

                //[-]

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

                //[-]

                this.AddRequired();
            }

            catch (Exception Ex)
            { throw Ex; }
            finally
            { this.mDa.Close(); }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Gets the Keys of the supplier datarow using the supplier Key Definition
        /// </summary>
        /// <param name="Dr">
        /// Source datarow
        /// </param>
        /// <param name="KeyNames">
        /// Key definition
        /// </param>
        /// <returns></returns>
        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, Do_Methods.Convert_Int64(Dr[Inner_Key], 0)); }
                else
                {
                    IsFound = true;
                    break;
                }
            }

            if (IsFound)
            { Key = null; }

            return Key;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Gets the Keys of the supplied row using the Key Definition of the Data Object
        /// </summary>
        /// <param name="Dr">
        /// Source datarow, mostly the same definition as from Me.List()
        /// </param>
        /// <returns></returns>
        public ClsKeys GetKeys(DataRow Dr)
        {
            ClsKeys Obj = new ClsKeys();

            foreach (string Key in this.mHeader_Key)
            {
                Int64 ID = Do_Methods.Convert_Int64(Dr[Key]);
                Obj.Add(Key, ID);
            }

            return Obj;
        }