Пример #1
0
        private static Cxversion GetOldData(int id, string OldDB)
        {
            string q = "USE " + OldDB + "; ";

            q += "SELECT * FROM " + CXVERSION.CXVERSION_TBL + " WHERE " + CXVERSION.CXVERSION_ID + " = '" + id + "'; ";

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    Cxversion obj = new Cxversion
                    {
                        Cxversion_name = redr[CXVERSION.CXVERSION_NAME].ToString(),
                        Created_on     = redr[CXVERSION.CREATED_ON].ToString(),
                        Changes        = redr[CXVERSION.CHANGES].ToString(),
                        Notes          = redr[CXVERSION.NOTES].ToString(),
                        Active_id      = redr[CXVERSION.ACTIVE_ID].ToString(),
                        User_id        = "1"
                    };

                    return(obj);
                }
                return(null);
            }
        }
Пример #2
0
        private static List <Cxversion> EntityList(string q)
        {
            List <Cxversion> list = new List <Cxversion>();

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    Cxversion obj = new Cxversion()
                    {
                        Cxversion_id   = redr[CXVERSION.CXVERSION_ID].ToString(),
                        Cxversion_name = redr[CXVERSION.CXVERSION_NAME].ToString(),
                        Created_on     = redr[CXVERSION.CREATED_ON].ToString(),
                        Changes        = redr[CXVERSION.CHANGES].ToString(),
                        Notes          = redr[CXVERSION.NOTES].ToString(),
                        Active_id      = redr[CXVERSION.ACTIVE_ID].ToString(),
                        User_id        = redr[USER.USER_NAME].ToString()
                    };

                    list.Add(obj);
                }

                redr.Close();
            }
            return(list);
        }
Пример #3
0
 private static void InsertData(Cxversion obj, string newDB)
 {
     if (CheckData(obj, newDB) == false)
     {
         CCxversion.Insert(obj, new DAL());
     }
     ;
 }
Пример #4
0
        public static string GetId_Name(string v)
        {
            Cxversion obj = SearchName(v);

            if (obj != null)
            {
                return(obj.Cxversion_id);
            }
            return("");
        }
Пример #5
0
        public static string GetName_Id(string v)
        {
            Cxversion obj = PKId(v);

            if (obj != null)
            {
                return(obj.Cxversion_name);
            }
            return("");
        }
Пример #6
0
 private static string AttachParams(string q, Cxversion v)
 {
     q = q.Replace("@" + CXVERSION.CXVERSION_ID + "@", "" + ConvertTO.SqlString(v.Cxversion_id) + "");
     q = q.Replace("@" + CXVERSION.CXVERSION_NAME + "@", "" + ConvertTO.SqlString(v.Cxversion_name) + "");
     q = q.Replace("@" + CXVERSION.CREATED_ON + "@", "" + ConvertTO.SqlDate(v.Created_on) + "");
     q = q.Replace("@" + CXVERSION.CHANGES + "@", "" + ConvertTO.SqlString(v.Changes) + "");
     q = q.Replace("@" + CXVERSION.NOTES + "@", "" + ConvertTO.SqlString(v.Notes) + "");
     q = q.Replace("@" + CXVERSION.ACTIVE_ID + "@", "" + ConvertTO.SqlString(v.Active_id) + "");
     q = q.Replace("@" + CXVERSION.USER_ID + "@", "" + ConvertTO.SqlString(v.User_id) + "");
     return(q);
 }
Пример #7
0
        public static void Update(Cxversion v, DAL dalsession)
        {
            string q = "UPDATE " + CXVERSION.CXVERSION_TBL + " SET";

            q += " " + CXVERSION.CXVERSION_NAME + " = @" + CXVERSION.CXVERSION_NAME + "@ \r\n ";
            q += "," + CXVERSION.CREATED_ON + " = @" + CXVERSION.CREATED_ON + "@ \r\n ";
            q += "," + CXVERSION.CHANGES + " = @" + CXVERSION.CHANGES + "@ \r\n ";
            q += "," + CXVERSION.NOTES + " = @" + CXVERSION.NOTES + "@ \r\n ";
            q += "," + CXVERSION.ACTIVE_ID + " = @" + CXVERSION.ACTIVE_ID + "@ \r\n ";
            q += "," + CXVERSION.USER_ID + " = @" + CXVERSION.USER_ID + "@ \r\n ";
            q += "  WHERE " + CXVERSION.CXVERSION_ID + " = @" + CXVERSION.CXVERSION_ID + "@ ";
            q  = AttachParams(q, v);
            dalsession.Execute(q);
        }
Пример #8
0
        private Cxversion CollectData()
        {
            Cxversion fobj = new Cxversion()
            {
                Cxversion_id   = vId,
                Cxversion_name = txt_cxversion_name.Text,
                Created_on     = txt_created_on.Text,
                Changes        = txt_changes.Text,
                Active_id      = Core.Stative,
                Notes          = txt_notes.Text,
                User_id        = Current.User
            };

            return(fobj);
        }
Пример #9
0
        private static bool CheckData(Cxversion obj, string newDB)
        {
            string q = "USE " + newDB + "; ";

            q += "SELECT * FROM " + CXVERSION.CXVERSION_TBL + " WHERE " + CXVERSION.CXVERSION_NAME + " = '" + obj.Cxversion_name + "'; ";

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    obj.Cxversion_id = redr[CXVERSION.CXVERSION_ID].ToString();

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

                    return(true);
                }
                return(false);
            }
        }
Пример #10
0
        public static void Insert(Cxversion v, DAL dalsession)
        {
            string q = " INSERT INTO " + CXVERSION.CXVERSION_TBL + " ( ";

            q += " " + CXVERSION.CXVERSION_NAME + " \r\n ";
            q += "," + CXVERSION.CREATED_ON + " \r\n ";
            q += "," + CXVERSION.CHANGES + " \r\n ";
            q += "," + CXVERSION.NOTES + " \r\n ";
            q += "," + CXVERSION.ACTIVE_ID + " \r\n ";
            q += "," + CXVERSION.USER_ID + " \r\n ";
            q += " ) VALUES ( ";
            q += "  @" + CXVERSION.CXVERSION_NAME + "@ \r\n ";
            q += ", @" + CXVERSION.CREATED_ON + "@ \r\n ";
            q += ", @" + CXVERSION.CHANGES + "@ \r\n ";
            q += ", @" + CXVERSION.NOTES + "@ \r\n ";
            q += ", @" + CXVERSION.ACTIVE_ID + "@ \r\n ";
            q += ", @" + CXVERSION.USER_ID + "@ \r\n ";
            q += " ) \r\n ";
            q  = AttachParams(q, v);
            dalsession.Execute(q);
        }
Пример #11
0
        public void SetAction(BtnEvent action, string pk)
        {
            fAction = action;

            switch (fAction)
            {
            case BtnEvent.Open:
                btn_save.Text = "&CLOSE";
                obj           = CCxversion_exten.PKId(pk);
                this.EnableControls(false);
                break;

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

            case BtnEvent.Edit:
                btn_save.Text = "&UPDATE";
                obj           = CCxversion_exten.PKId(pk);
                this.EnableControls(true);
                break;

            case BtnEvent.Delete:
                btn_save.Text = "CONFIRM\r\n&DELETE";
                obj           = CCxversion_exten.PKId(pk);
                this.EnableControls(false);
                break;

            case BtnEvent.Print:
                btn_save.Text = "&PRINT";
                obj           = CCxversion_exten.PKId(pk);
                this.EnableControls(false);
                break;
            }

            this.LoadData();
        }