Esempio n. 1
0
 private static void InsertData(Salestype obj, string newDB)
 {
     if (CheckData(obj, newDB) == false)
     {
         CSalestype.Insert(obj, new DAL());
     }
     ;
 }
Esempio n. 2
0
 private static string AttachParams(string q, Salestype v)
 {
     q = q.Replace("@" + SALESTYPE.SALESTYPE_ID + "@", "" + ConvertTO.SqlString(v.Salestype_id) + "");
     q = q.Replace("@" + SALESTYPE.SALESTYPE_NAME + "@", "" + ConvertTO.SqlString(v.Salestype_name) + "");
     q = q.Replace("@" + SALESTYPE.NOTES + "@", "" + ConvertTO.SqlString(v.Notes) + "");
     q = q.Replace("@" + SALESTYPE.ACTIVE_ID + "@", "" + ConvertTO.SqlString(v.Active_id) + "");
     q = q.Replace("@" + SALESTYPE.USER_ID + "@", "" + ConvertTO.SqlString(v.User_id) + "");
     return(q);
 }
Esempio n. 3
0
        public static string GetId_Name(string _pName)
        {
            Salestype obj = SearchName(_pName, new DAL());

            if (obj != null)
            {
                return(obj.Salestype_id);
            }
            return("");
        }
Esempio n. 4
0
        public static string GetName_Id(string _pId)
        {
            Salestype obj = PKId(_pId, new DAL());

            if (obj != null)
            {
                return(obj.Salestype_name);
            }
            return("");
        }
Esempio n. 5
0
        public static void Update(Salestype v, DAL dalsession)
        {
            string q = "UPDATE " + SALESTYPE.SALESTYPE_TBL + " SET";

            q += " " + SALESTYPE.SALESTYPE_NAME + " = @" + SALESTYPE.SALESTYPE_NAME + "@ \r\n ";
            q += "," + SALESTYPE.NOTES + " = @" + SALESTYPE.NOTES + "@ \r\n ";
            q += "," + SALESTYPE.ACTIVE_ID + " = @" + SALESTYPE.ACTIVE_ID + "@ \r\n ";
            q += "," + SALESTYPE.USER_ID + " = @" + SALESTYPE.USER_ID + "@ \r\n ";
            q += "  WHERE " + SALESTYPE.SALESTYPE_ID + " = @" + SALESTYPE.SALESTYPE_ID + "@ ";
            q  = AttachParams(q, v);
            dalsession.Execute(q);
        }
Esempio n. 6
0
        private Salestype CollectData()
        {
            Salestype fobj = new Salestype()
            {
                Salestype_id   = vId,
                Salestype_name = txt_salestype_name.Text,
                Active_id      = Core.Stative,
                Notes          = txt_notes.Text,
                User_id        = Current.User
            };

            return(fobj);
        }
Esempio n. 7
0
        public static void Insert(Salestype v, DAL dalsession)
        {
            string q = " INSERT INTO " + SALESTYPE.SALESTYPE_TBL + " ( ";

            q += " " + SALESTYPE.SALESTYPE_NAME + " \r\n ";
            q += "," + SALESTYPE.NOTES + " \r\n ";
            q += "," + SALESTYPE.ACTIVE_ID + " \r\n ";
            q += "," + SALESTYPE.USER_ID + " \r\n ";
            q += " ) VALUES ( ";
            q += "  @" + SALESTYPE.SALESTYPE_NAME + "@ \r\n ";
            q += ", @" + SALESTYPE.NOTES + "@ \r\n ";
            q += ", @" + SALESTYPE.ACTIVE_ID + "@ \r\n ";
            q += ", @" + SALESTYPE.USER_ID + "@ \r\n ";
            q += " ) \r\n ";
            q  = AttachParams(q, v);
            dalsession.Execute(q);
        }
Esempio n. 8
0
        private static bool CheckData(Salestype obj, string newDB)
        {
            string q = "USE " + newDB + "; ";

            q += "SELECT * FROM " + SALESTYPE.SALESTYPE_TBL + " WHERE " + SALESTYPE.SALESTYPE_NAME + " = '" + obj.Salestype_name + "'; ";

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    obj.Salestype_id = redr[SALESTYPE.SALESTYPE_ID].ToString();

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

                    return(true);
                }
                return(false);
            }
        }
Esempio n. 9
0
 private static Salestype EntityData(string q)
 {
     using (IDataReader redr = new DAL().Listreader(q))
     {
         while (redr.Read() == true)
         {
             Salestype obj = new Salestype()
             {
                 Salestype_id   = redr[SALESTYPE.SALESTYPE_ID].ToString(),
                 Salestype_name = redr[SALESTYPE.SALESTYPE_NAME].ToString(),
                 Notes          = redr[SALESTYPE.NOTES].ToString(),
                 Active_id      = redr[SALESTYPE.ACTIVE_ID].ToString(),
                 User_id        = redr[USER.USER_NAME].ToString()
             };
             return(obj);
         }
         redr.Close();
         return(new Salestype());
     }
 }
Esempio n. 10
0
        public void SetAction(BtnEvent pAction, string pPkValue)
        {
            fAction = pAction;

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

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

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

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

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

            this.LoadData();
        }
Esempio n. 11
0
        private static Salestype GetOldData(int id, string OldDB)
        {
            string q = "USE " + OldDB + "; ";

            q += "SELECT * FROM " + SALESTYPE.SALESTYPE_TBL + " WHERE " + SALESTYPE.SALESTYPE_ID + " = '" + id + "'; ";

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    Salestype obj = new Salestype
                    {
                        Salestype_name = redr[SALESTYPE.SALESTYPE_NAME].ToString(),
                        Notes          = redr[SALESTYPE.NOTES].ToString(),
                        Active_id      = redr[SALESTYPE.ACTIVE_ID].ToString(),
                        User_id        = "1"
                    };

                    return(obj);
                }
                return(null);
            }
        }
Esempio n. 12
0
        private static List <Salestype> EntityList(string q)
        {
            List <Salestype> list = new List <Salestype>();

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    Salestype obj = new Salestype()
                    {
                        Salestype_id   = redr[SALESTYPE.SALESTYPE_ID].ToString(),
                        Salestype_name = redr[SALESTYPE.SALESTYPE_NAME].ToString(),
                        Notes          = redr[SALESTYPE.NOTES].ToString(),
                        Active_id      = redr[SALESTYPE.ACTIVE_ID].ToString(),
                        User_id        = redr[USER.USER_NAME].ToString()
                    };

                    list.Add(obj);
                }

                redr.Close();
            }
            return(list);
        }