Example #1
0
 private static string AttachParams(string q, Receipttype v)
 {
     q = q.Replace("@" + RECEIPTTYPE.RECEIPTTYPE_ID + "@", "" + ConvertTO.SqlString(v.Receipttype_id) + "");
     q = q.Replace("@" + RECEIPTTYPE.RECEIPTTYPE_NAME + "@", "" + ConvertTO.SqlString(v.Receipttype_name) + "");
     q = q.Replace("@" + RECEIPTTYPE.NOTES + "@", "" + ConvertTO.SqlString(v.Notes) + "");
     q = q.Replace("@" + RECEIPTTYPE.ACTIVE_ID + "@", "" + ConvertTO.SqlString(v.Active_id) + "");
     q = q.Replace("@" + RECEIPTTYPE.USER_ID + "@", "" + ConvertTO.SqlString(v.User_id) + "");
     return(q);
 }
Example #2
0
 private static void InsertData(Receipttype obj, string newDB)
 {
     if (CheckData(obj, newDB) == false)
     {
         obj.Receipttype_name = obj.Receipttype_name.ToUpper();
         CReceipttype.Insert(obj, new DAL());
     }
     ;
 }
        public static string GetId_Name(string _pName)
        {
            Receipttype obj = SearchName(_pName, new DAL());

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

            if (obj != null)
            {
                return(obj.Receipttype_name);
            }
            return("");
        }
Example #5
0
        public static void Update(Receipttype v, DAL dalsession)
        {
            string q = "UPDATE " + RECEIPTTYPE.RECEIPTTYPE_TBL + " SET";

            q += " " + RECEIPTTYPE.RECEIPTTYPE_NAME + " = @" + RECEIPTTYPE.RECEIPTTYPE_NAME + "@ \r\n ";
            q += "," + RECEIPTTYPE.NOTES + " = @" + RECEIPTTYPE.NOTES + "@ \r\n ";
            q += "," + RECEIPTTYPE.ACTIVE_ID + " = @" + RECEIPTTYPE.ACTIVE_ID + "@ \r\n ";
            q += "," + RECEIPTTYPE.USER_ID + " = @" + RECEIPTTYPE.USER_ID + "@ \r\n ";
            q += "  WHERE " + RECEIPTTYPE.RECEIPTTYPE_ID + " = @" + RECEIPTTYPE.RECEIPTTYPE_ID + "@ ";
            q  = AttachParams(q, v);
            dalsession.Execute(q);
        }
Example #6
0
        private Receipttype CollectData()
        {
            Receipttype fobj = new Receipttype()
            {
                Receipttype_id   = vId,
                Receipttype_name = txt_receipttype_name.Text.ToUpper(),
                Active_id        = Core.Stative,
                Notes            = txt_notes.Text,
                User_id          = Current.User
            };

            return(fobj);
        }
Example #7
0
        public static void Insert(Receipttype v, DAL dalsession)
        {
            string q = " INSERT INTO " + RECEIPTTYPE.RECEIPTTYPE_TBL + " ( ";

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

            q += "SELECT * FROM " + RECEIPTTYPE.RECEIPTTYPE_TBL + " WHERE " + RECEIPTTYPE.RECEIPTTYPE_NAME + " = '" + obj.Receipttype_name + "'; ";

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    obj.Receipttype_id   = redr[RECEIPTTYPE.RECEIPTTYPE_ID].ToString();
                    obj.Receipttype_name = obj.Receipttype_name.ToUpper();
                    CReceipttype.Update(obj, new DAL());

                    return(true);
                }
                return(false);
            }
        }
 private static Receipttype EntityData(string q)
 {
     using (IDataReader redr = new DAL().Listreader(q))
     {
         while (redr.Read() == true)
         {
             Receipttype obj = new Receipttype()
             {
                 Receipttype_id   = redr[RECEIPTTYPE.RECEIPTTYPE_ID].ToString(),
                 Receipttype_name = redr[RECEIPTTYPE.RECEIPTTYPE_NAME].ToString(),
                 Notes            = redr[RECEIPTTYPE.NOTES].ToString(),
                 Active_id        = redr[RECEIPTTYPE.ACTIVE_ID].ToString(),
                 User_id          = redr[USER.USER_NAME].ToString()
             };
             return(obj);
         }
         redr.Close();
         return(new Receipttype());
     }
 }
Example #10
0
        public void SetAction(BtnEvent pAction, string pPkValue)
        {
            fAction = pAction;

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

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

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

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

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

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

            q += "SELECT * FROM " + RECEIPTTYPE.RECEIPTTYPE_TBL + " WHERE " + RECEIPTTYPE.RECEIPTTYPE_ID + " = '" + id + "'; ";

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    Receipttype obj = new Receipttype
                    {
                        Receipttype_name = redr[RECEIPTTYPE.RECEIPTTYPE_NAME].ToString(),
                        Notes            = redr[RECEIPTTYPE.NOTES].ToString(),
                        Active_id        = redr[RECEIPTTYPE.ACTIVE_ID].ToString(),
                        User_id          = "1"
                    };

                    return(obj);
                }
                return(null);
            }
        }
        private static List <Receipttype> EntityList(string q)
        {
            List <Receipttype> list = new List <Receipttype>();

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    Receipttype obj = new Receipttype()
                    {
                        Receipttype_id   = redr[RECEIPTTYPE.RECEIPTTYPE_ID].ToString(),
                        Receipttype_name = redr[RECEIPTTYPE.RECEIPTTYPE_NAME].ToString(),
                        Notes            = redr[RECEIPTTYPE.NOTES].ToString(),
                        Active_id        = redr[RECEIPTTYPE.ACTIVE_ID].ToString(),
                        User_id          = redr[USER.USER_NAME].ToString()
                    };

                    list.Add(obj);
                }

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