Beispiel #1
0
 private static void InsertData(Ledgergroup obj, string newDB)
 {
     if (CheckData(obj, newDB) == false)
     {
         CLedgergroup.Insert(obj, new DAL());
     }
     ;
 }
Beispiel #2
0
 private static string AttachParams(string q, Ledgergroup v)
 {
     q = q.Replace("@" + LEDGERGROUP.LEDGERGROUP_ID + "@", "" + ConvertTO.SqlString(v.Ledgergroup_id) + "");
     q = q.Replace("@" + LEDGERGROUP.LEDGERGROUP_NAME + "@", "" + ConvertTO.SqlString(v.Ledgergroup_name) + "");
     q = q.Replace("@" + LEDGERGROUP.NOTES + "@", "" + ConvertTO.SqlString(v.Notes) + "");
     q = q.Replace("@" + LEDGERGROUP.ACTIVE_ID + "@", "" + ConvertTO.SqlString(v.Active_id) + "");
     q = q.Replace("@" + LEDGERGROUP.USER_ID + "@", "" + ConvertTO.SqlString(v.User_id) + "");
     return(q);
 }
        public static string GetId_Name(string _pName)
        {
            Ledgergroup obj = SearchName(_pName, new DAL());

            if (obj != null)
            {
                return(obj.Ledgergroup_id);
            }
            return("");
        }
        public static string GetName_Id(string _pId)
        {
            Ledgergroup obj = PKId(_pId, new DAL());

            if (obj != null)
            {
                return(obj.Ledgergroup_name);
            }
            return("");
        }
Beispiel #5
0
        public static void Update(Ledgergroup v, DAL dalsession)
        {
            string q = "UPDATE " + LEDGERGROUP.LEDGERGROUP_TBL + " SET";

            q += " " + LEDGERGROUP.LEDGERGROUP_NAME + " = @" + LEDGERGROUP.LEDGERGROUP_NAME + "@ \r\n ";
            q += "," + LEDGERGROUP.NOTES + " = @" + LEDGERGROUP.NOTES + "@ \r\n ";
            q += "," + LEDGERGROUP.ACTIVE_ID + " = @" + LEDGERGROUP.ACTIVE_ID + "@ \r\n ";
            q += "," + LEDGERGROUP.USER_ID + " = @" + LEDGERGROUP.USER_ID + "@ \r\n ";
            q += "  WHERE " + LEDGERGROUP.LEDGERGROUP_ID + " = @" + LEDGERGROUP.LEDGERGROUP_ID + "@ ";
            q  = AttachParams(q, v);
            dalsession.Execute(q);
        }
Beispiel #6
0
        private Ledgergroup CollectData()
        {
            Ledgergroup fobj = new Ledgergroup()
            {
                Ledgergroup_id   = vId,
                Ledgergroup_name = txt_ledgergroup_name.Text,
                Active_id        = Core.Stative,
                Notes            = txt_notes.Text,
                User_id          = Current.User
            };

            return(fobj);
        }
Beispiel #7
0
        public static void Insert(Ledgergroup v, DAL dalsession)
        {
            string q = " INSERT INTO " + LEDGERGROUP.LEDGERGROUP_TBL + " ( ";

            q += " " + LEDGERGROUP.LEDGERGROUP_NAME + " \r\n ";
            q += "," + LEDGERGROUP.NOTES + " \r\n ";
            q += "," + LEDGERGROUP.ACTIVE_ID + " \r\n ";
            q += "," + LEDGERGROUP.USER_ID + " \r\n ";
            q += " ) VALUES ( ";
            q += "  @" + LEDGERGROUP.LEDGERGROUP_NAME + "@ \r\n ";
            q += ", @" + LEDGERGROUP.NOTES + "@ \r\n ";
            q += ", @" + LEDGERGROUP.ACTIVE_ID + "@ \r\n ";
            q += ", @" + LEDGERGROUP.USER_ID + "@ \r\n ";
            q += " ) \r\n ";
            q  = AttachParams(q, v);
            dalsession.Execute(q);
        }
Beispiel #8
0
        private static bool CheckData(Ledgergroup obj, string newDB)
        {
            string q = "USE " + newDB + "; ";

            q += "SELECT * FROM " + LEDGERGROUP.LEDGERGROUP_TBL + " WHERE " + LEDGERGROUP.LEDGERGROUP_NAME + " = '" + obj.Ledgergroup_name + "'; ";

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    obj.Ledgergroup_id = redr[LEDGERGROUP.LEDGERGROUP_ID].ToString();

                    CLedgergroup.Update(obj, new DAL());

                    return(true);
                }
                return(false);
            }
        }
 private static Ledgergroup EntityData(string q)
 {
     using (IDataReader redr = new DAL().Listreader(q))
     {
         while (redr.Read() == true)
         {
             Ledgergroup obj = new Ledgergroup()
             {
                 Ledgergroup_id   = redr[LEDGERGROUP.LEDGERGROUP_ID].ToString(),
                 Ledgergroup_name = redr[LEDGERGROUP.LEDGERGROUP_NAME].ToString(),
                 Notes            = redr[LEDGERGROUP.NOTES].ToString(),
                 Active_id        = redr[LEDGERGROUP.ACTIVE_ID].ToString(),
                 User_id          = redr[USER.USER_NAME].ToString()
             };
             return(obj);
         }
         redr.Close();
         return(new Ledgergroup());
     }
 }
Beispiel #10
0
        public void SetAction(BtnEvent pAction, string pPkValue)
        {
            fAction = pAction;

            switch (fAction)
            {
            case BtnEvent.Open:
                btn_save.Text = "&CLOSE";
                obj           = CLedgergroup_exten.PKId(pPkValue, new DAL());
                this.EnableControls(false);
                break;

            case BtnEvent.New:
                btn_save.Text = "&SAVE";
                obj           = CLedgergroup.GetNew;
                this.EnableControls(true);
                break;

            case BtnEvent.Edit:
                btn_save.Text = "&UPDATE";
                obj           = CLedgergroup_exten.PKId(pPkValue, new DAL());
                this.EnableControls(true);
                break;

            case BtnEvent.Delete:
                btn_save.Text = "CONFIRM\r\n&DELETE";
                obj           = CLedgergroup_exten.PKId(pPkValue, new DAL());
                this.EnableControls(false);
                break;

            case BtnEvent.Print:
                btn_save.Text = "&PRINT";
                obj           = CLedgergroup_exten.PKId(pPkValue, new DAL());
                this.EnableControls(false);
                break;
            }

            this.LoadData();
        }
Beispiel #11
0
        private static Ledgergroup GetOldData(int id, string OldDB)
        {
            string q = "USE " + OldDB + "; ";

            q += "SELECT * FROM " + LEDGERGROUP.LEDGERGROUP_TBL + " WHERE " + LEDGERGROUP.LEDGERGROUP_ID + " = '" + id + "'; ";

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    Ledgergroup obj = new Ledgergroup
                    {
                        Ledgergroup_name = redr[LEDGERGROUP.LEDGERGROUP_NAME].ToString(),
                        Notes            = redr[LEDGERGROUP.NOTES].ToString(),
                        Active_id        = redr[LEDGERGROUP.ACTIVE_ID].ToString(),
                        User_id          = "1"
                    };

                    return(obj);
                }
                return(null);
            }
        }