示例#1
0
 private static string AttachParams(string q, Defaultcompany v)
 {
     q = q.Replace("@" + DEFAULTCOMPANY.DEFAULTCOMPANY_ID + "@", "" + ConvertTO.SqlString(v.Defaultcompany_id) + "");
     q = q.Replace("@" + DEFAULTCOMPANY.COMPANY_ID + "@", "" + ConvertTO.SqlString(v.Company_id) + "");
     q = q.Replace("@" + DEFAULTCOMPANY.ACY_ID + "@", "" + ConvertTO.SqlString(v.Acy_id) + "");
     return(q);
 }
示例#2
0
 private static void InsertData(Defaultcompany obj, string newDB)
 {
     if (CheckData(obj, newDB) == false)
     {
         CDefaultcompany.Insert(obj, new DAL());
     }
     ;
 }
示例#3
0
        public static void Update(Defaultcompany v, DAL dalsession)
        {
            string q = "UPDATE " + DEFAULTCOMPANY.DEFAULTCOMPANY_TBL + " SET";

            q += " " + DEFAULTCOMPANY.COMPANY_ID + " = @" + DEFAULTCOMPANY.COMPANY_ID + "@ \r\n ";
            q += "," + DEFAULTCOMPANY.ACY_ID + " = @" + DEFAULTCOMPANY.ACY_ID + "@ \r\n ";
            q += "  WHERE " + DEFAULTCOMPANY.DEFAULTCOMPANY_ID + " = @" + DEFAULTCOMPANY.DEFAULTCOMPANY_ID + "@ ";
            q  = AttachParams(q, v);
            dalsession.Execute(q);
        }
示例#4
0
        private void Btn_default_Click(object sender, EventArgs e)
        {
            Defaultcompany obj = new Defaultcompany()
            {
                Defaultcompany_id = "1",
                Company_id        = Current.Company_id,
                Acy_id            = GetSelectedPkValue()
            };

            CDefaultcompany.Update(obj, new DAL());
            Load_sacy();
        }
示例#5
0
        private void Btn_removedefault_Click(object sender, EventArgs e)
        {
            Defaultcompany obj = new Defaultcompany()
            {
                Defaultcompany_id = "1",
                Company_id        = "NO",
                Acy_id            = "NO"
            };

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

            Load_sacy();
        }
示例#6
0
        public static void Insert(Defaultcompany v, DAL dalsession)
        {
            string q = " INSERT INTO " + DEFAULTCOMPANY.DEFAULTCOMPANY_TBL + " ( ";

            q += " " + DEFAULTCOMPANY.COMPANY_ID + " \r\n ";
            q += "," + DEFAULTCOMPANY.ACY_ID + " \r\n ";
            q += " ) VALUES ( ";
            q += "  @" + DEFAULTCOMPANY.COMPANY_ID + "@ \r\n ";
            q += ", @" + DEFAULTCOMPANY.ACY_ID + "@ \r\n ";
            q += " ) \r\n ";
            q  = AttachParams(q, v);
            dalsession.Execute(q);
        }
示例#7
0
        private static bool CheckData(Defaultcompany obj, string newDB)
        {
            string q = "USE " + newDB + "; ";

            q += "SELECT * FROM " + DEFAULTCOMPANY.DEFAULTCOMPANY_TBL + " WHERE " + DEFAULTCOMPANY.DEFAULTCOMPANY_NAME + " = '" + obj.Defaultcompany_name + "'; ";

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    obj.Defaultcompany_id = redr[DEFAULTCOMPANY.DEFAULTCOMPANY_ID].ToString();

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

                    return(true);
                }
                return(false);
            }
        }
示例#8
0
        private static Defaultcompany EntityData(string q)
        {
            using (IDataReader redr = new DAL().Listreader(q))

            {
                while (redr.Read() == true)
                {
                    Defaultcompany obj = new Defaultcompany()
                    {
                        Defaultcompany_id = redr[DEFAULTCOMPANY.DEFAULTCOMPANY_ID].ToString(),
                        Company_id        = redr[DEFAULTCOMPANY.COMPANY_ID].ToString(),
                        Acy_id            = redr[DEFAULTCOMPANY.ACY_ID].ToString()
                    };

                    return(obj);
                }

                redr.Close();
                return(new Defaultcompany());
            }
        }
示例#9
0
        private static Defaultcompany GetOldData(int id, string OldDB)
        {
            string q = "USE " + OldDB + "; ";

            q += "SELECT * FROM " + DEFAULTCOMPANY.DEFAULTCOMPANY_TBL + " WHERE " + DEFAULTCOMPANY.DEFAULTCOMPANY_ID + " = '" + id + "'; ";

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    Defaultcompany obj = new Defaultcompany
                    {
                        Company_id = ConvertTO.Integer(redr[DEFAULTCOMPANY.COMPANY_ID].ToString()),
                        Acy_id     = ConvertTO.Integer(redr[DEFAULTCOMPANY.ACY_ID].ToString()),
                        Notes      = redr[DEFAULTCOMPANY.NOTES].ToString(),
                        Active_id  = redr[DEFAULTCOMPANY.ACTIVE_ID].ToString(),
                        User_id    = "1"
                    };

                    return(obj);
                }
                return(null);
            }
        }