Ejemplo n.º 1
0
 private static void InsertData(Pincode obj, string newDB)
 {
     if (CheckData(obj, newDB) == false)
     {
         obj.Pincode_name = obj.Pincode_name.Replace(" ", string.Empty);
         CPincode.Insert(obj, new DAL());
     }
     ;
 }
Ejemplo n.º 2
0
 private static string AttachParams(string q, Pincode v)
 {
     q = q.Replace("@" + PINCODE.PINCODE_ID + "@", "" + ConvertTO.SqlString(v.Pincode_id) + "");
     q = q.Replace("@" + PINCODE.PINCODE_NAME + "@", "" + ConvertTO.SqlString(v.Pincode_name) + "");
     q = q.Replace("@" + PINCODE.NOTES + "@", "" + ConvertTO.SqlString(v.Notes) + "");
     q = q.Replace("@" + PINCODE.ACTIVE_ID + "@", "" + ConvertTO.SqlString(v.Active_id) + "");
     q = q.Replace("@" + PINCODE.USER_ID + "@", "" + ConvertTO.SqlString(v.User_id) + "");
     return(q);
 }
Ejemplo n.º 3
0
        public static string GetId_Name(string _pName)
        {
            Pincode obj = SearchName(_pName, new DAL());

            if (obj != null)
            {
                return(obj.Pincode_id);
            }
            return("");
        }
Ejemplo n.º 4
0
        public static string GetName_Id(string _pId)
        {
            Pincode obj = PKId(_pId, new DAL());

            if (obj != null)
            {
                return(obj.Pincode_name);
            }
            return("");
        }
Ejemplo n.º 5
0
        public static void Update(Pincode v, DAL dalsession)
        {
            string q = "UPDATE " + PINCODE.PINCODE_TBL + " SET";

            q += " " + PINCODE.PINCODE_NAME + " = @" + PINCODE.PINCODE_NAME + "@ \r\n ";
            q += "," + PINCODE.NOTES + " = @" + PINCODE.NOTES + "@ \r\n ";
            q += "," + PINCODE.ACTIVE_ID + " = @" + PINCODE.ACTIVE_ID + "@ \r\n ";
            q += "," + PINCODE.USER_ID + " = @" + PINCODE.USER_ID + "@ \r\n ";
            q += "  WHERE " + PINCODE.PINCODE_ID + " = @" + PINCODE.PINCODE_ID + "@ ";
            q  = AttachParams(q, v);
            dalsession.Execute(q);
        }
Ejemplo n.º 6
0
        private Pincode CollectData()
        {
            Pincode fobj = new Pincode()
            {
                Pincode_id   = vId,
                Pincode_name = txt_pincode_name.Text.Replace(" ", string.Empty),
                Active_id    = Core.Stative,
                Notes        = txt_notes.Text,
                User_id      = Current.User
            };

            return(fobj);
        }
Ejemplo n.º 7
0
        public static void Insert(Pincode v, DAL dalsession)
        {
            string q = " INSERT INTO " + PINCODE.PINCODE_TBL + " ( ";

            q += " " + PINCODE.PINCODE_NAME + " \r\n ";
            q += "," + PINCODE.NOTES + " \r\n ";
            q += "," + PINCODE.ACTIVE_ID + " \r\n ";
            q += "," + PINCODE.USER_ID + " \r\n ";
            q += " ) VALUES ( ";
            q += "  @" + PINCODE.PINCODE_NAME + "@ \r\n ";
            q += ", @" + PINCODE.NOTES + "@ \r\n ";
            q += ", @" + PINCODE.ACTIVE_ID + "@ \r\n ";
            q += ", @" + PINCODE.USER_ID + "@ \r\n ";
            q += " ) \r\n ";
            q  = AttachParams(q, v);
            dalsession.Execute(q);
        }
Ejemplo n.º 8
0
        private static bool CheckData(Pincode obj, string newDB)
        {
            string q = "USE " + newDB + "; ";

            q += "SELECT * FROM " + PINCODE.PINCODE_TBL + " WHERE " + PINCODE.PINCODE_NAME + " = '" + obj.Pincode_name + "'; ";

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    obj.Pincode_id   = redr[PINCODE.PINCODE_ID].ToString();
                    obj.Pincode_name = obj.Pincode_name.Replace(" ", string.Empty);
                    CPincode.Update(obj, new DAL());

                    return(true);
                }
                return(false);
            }
        }
Ejemplo n.º 9
0
 private static Pincode EntityData(string q)
 {
     using (IDataReader redr = new DAL().Listreader(q))
     {
         while (redr.Read() == true)
         {
             Pincode obj = new Pincode()
             {
                 Pincode_id   = redr[PINCODE.PINCODE_ID].ToString(),
                 Pincode_name = redr[PINCODE.PINCODE_NAME].ToString(),
                 Notes        = redr[PINCODE.NOTES].ToString(),
                 Active_id    = redr[PINCODE.ACTIVE_ID].ToString(),
                 User_id      = redr[USER.USER_NAME].ToString()
             };
             return(obj);
         }
         redr.Close();
         return(new Pincode());
     }
 }
Ejemplo n.º 10
0
        public void SetAction(BtnEvent pAction, string pPkValue)
        {
            fAction = pAction;

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

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

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

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

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

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

            q += "SELECT * FROM " + PINCODE.PINCODE_TBL + " WHERE " + PINCODE.PINCODE_ID + " = '" + id + "'; ";

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    Pincode obj = new Pincode
                    {
                        Pincode_name = redr[PINCODE.PINCODE_NAME].ToString(),
                        Notes        = redr[PINCODE.NOTES].ToString(),
                        Active_id    = redr[PINCODE.ACTIVE_ID].ToString(),
                        User_id      = "1"
                    };

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

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    Pincode obj = new Pincode()
                    {
                        Pincode_id   = redr[PINCODE.PINCODE_ID].ToString(),
                        Pincode_name = redr[PINCODE.PINCODE_NAME].ToString(),
                        Notes        = redr[PINCODE.NOTES].ToString(),
                        Active_id    = redr[PINCODE.ACTIVE_ID].ToString(),
                        User_id      = redr[USER.USER_NAME].ToString()
                    };

                    list.Add(obj);
                }

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