コード例 #1
0
ファイル: U_Pincode.cs プロジェクト: CODEXSUN/codexdotnet
 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());
     }
     ;
 }
コード例 #2
0
ファイル: CPincode.cs プロジェクト: CODEXSUN/codexdotnet
 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);
 }
コード例 #3
0
        public static string GetId_Name(string _pName)
        {
            Pincode obj = SearchName(_pName, new DAL());

            if (obj != null)
            {
                return(obj.Pincode_id);
            }
            return("");
        }
コード例 #4
0
        public static string GetName_Id(string _pId)
        {
            Pincode obj = PKId(_pId, new DAL());

            if (obj != null)
            {
                return(obj.Pincode_name);
            }
            return("");
        }
コード例 #5
0
ファイル: CPincode.cs プロジェクト: CODEXSUN/codexdotnet
        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);
        }
コード例 #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);
        }
コード例 #7
0
ファイル: CPincode.cs プロジェクト: CODEXSUN/codexdotnet
        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);
        }
コード例 #8
0
ファイル: U_Pincode.cs プロジェクト: CODEXSUN/codexdotnet
        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);
            }
        }
コード例 #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());
     }
 }
コード例 #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();
        }
コード例 #11
0
ファイル: U_Pincode.cs プロジェクト: CODEXSUN/codexdotnet
        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);
            }
        }
コード例 #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);
        }