Example #1
0
            private static void InsertData(Contacttype obj, string newDB)
            {
                if (CheckData(obj, newDB) == false)
                {
                    CContacttype.Insert(obj, new DAL());
                };

            }
Example #2
0
 private static string AttachParams(string q, Contacttype v)
 {
     q = q.Replace("@" + CONTACTTYPE.CONTACTTYPE_ID + "@", "" + ConvertTO.SqlString(v.Contacttype_id) + "");
     q = q.Replace("@" + CONTACTTYPE.CONTACTTYPE_NAME + "@", "" + ConvertTO.SqlString(v.Contacttype_name) + "");
     q = q.Replace("@" + CONTACTTYPE.NOTES + "@", "" + ConvertTO.SqlString(v.Notes) + "");
     q = q.Replace("@" + CONTACTTYPE.ACTIVE_ID + "@", "" + ConvertTO.SqlString(v.Active_id) + "");
     q = q.Replace("@" + CONTACTTYPE.USER_ID + "@", "" + ConvertTO.SqlString(v.User_id) + "");
     return(q);
 }
        public static string GetId_Name(string _pName)
        {
            Contacttype obj = SearchName(_pName);

            if (obj != null)
            {
                return(obj.Contacttype_id);
            }
            return("");
        }
        public static string GetName_Id(string _pId)
        {
            Contacttype obj = PKId(_pId);

            if (obj != null)
            {
                return(obj.Contacttype_name);
            }
            return("");
        }
Example #5
0
        public static void Update(Contacttype v, DAL dalsession)
        {
            string q = "UPDATE " + CONTACTTYPE.CONTACTTYPE_TBL + " SET";

            q += " " + CONTACTTYPE.CONTACTTYPE_NAME + " = @" + CONTACTTYPE.CONTACTTYPE_NAME + "@ \r\n ";
            q += "," + CONTACTTYPE.NOTES + " = @" + CONTACTTYPE.NOTES + "@ \r\n ";
            q += "," + CONTACTTYPE.ACTIVE_ID + " = @" + CONTACTTYPE.ACTIVE_ID + "@ \r\n ";
            q += "," + CONTACTTYPE.USER_ID + " = @" + CONTACTTYPE.USER_ID + "@ \r\n ";
            q += "  WHERE " + CONTACTTYPE.CONTACTTYPE_ID + " = @" + CONTACTTYPE.CONTACTTYPE_ID + "@ ";
            q  = AttachParams(q, v);
            dalsession.Execute(q);
        }
Example #6
0
        private Contacttype CollectData()
        {
            Contacttype fobj = new Contacttype()
            {
                Contacttype_id   = vId,
                Contacttype_name = txt_contacttype_name.Text,
                Active_id        = Core.Stative,
                Notes            = txt_notes.Text,
                User_id          = Current.User
            };

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

            q += " " + CONTACTTYPE.CONTACTTYPE_NAME + " \r\n ";
            q += "," + CONTACTTYPE.NOTES + " \r\n ";
            q += "," + CONTACTTYPE.ACTIVE_ID + " \r\n ";
            q += "," + CONTACTTYPE.USER_ID + " \r\n ";
            q += " ) VALUES ( ";
            q += "  @" + CONTACTTYPE.CONTACTTYPE_NAME + "@ \r\n ";
            q += ", @" + CONTACTTYPE.NOTES + "@ \r\n ";
            q += ", @" + CONTACTTYPE.ACTIVE_ID + "@ \r\n ";
            q += ", @" + CONTACTTYPE.USER_ID + "@ \r\n ";
            q += " ) \r\n ";
            q  = AttachParams(q, v);
            dalsession.Execute(q);
        }
Example #8
0
            private static bool CheckData(Contacttype obj, string newDB)
            {
                string q = "USE " + newDB + "; ";
                q += "SELECT * FROM " + CONTACTTYPE.CONTACTTYPE_TBL + " WHERE " + CONTACTTYPE.CONTACTTYPE_NAME + " = '" + obj.Contacttype_name + "'; ";

                using (IDataReader redr = new DAL().Listreader(q))
                {
                    while (redr.Read() == true)
                    {
                        obj.Contacttype_id = redr[CONTACTTYPE.CONTACTTYPE_ID].ToString();

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

                        return true;
                    }
                    return false;
                }
            }
 private static Contacttype EntityData(string q)
 {
     using (IDataReader redr = new DAL().Listreader(q))
     {
         while (redr.Read() == true)
         {
             Contacttype obj = new Contacttype()
             {
                 Contacttype_id   = redr[CONTACTTYPE.CONTACTTYPE_ID].ToString(),
                 Contacttype_name = redr[CONTACTTYPE.CONTACTTYPE_NAME].ToString(),
                 Notes            = redr[CONTACTTYPE.NOTES].ToString(),
                 Active_id        = redr[CONTACTTYPE.ACTIVE_ID].ToString(),
                 User_id          = redr[USER.USER_NAME].ToString()
             };
             return(obj);
         }
         redr.Close();
         return(new Contacttype());
     }
 }
Example #10
0
            private static Contacttype GetOldData(int id, string OldDB)
            {
                string q = "USE " + OldDB + "; ";
                q += "SELECT * FROM " + CONTACTTYPE.CONTACTTYPE_TBL + " WHERE " + CONTACTTYPE.CONTACTTYPE_ID + " = '" + id + "'; ";

                using (IDataReader redr = new DAL().Listreader(q))
                {
                    while (redr.Read() == true)
                    {
                        Contacttype obj = new Contacttype
                        {
                        Contacttype_name = redr[CONTACTTYPE.CONTACTTYPE_NAME].ToString(),
                        Notes = redr[CONTACTTYPE.NOTES].ToString(),
                        Active_id = redr[CONTACTTYPE.ACTIVE_ID].ToString(),
                        User_id = "1"
                        };

                        return obj;
                    }
                    return null;
                }
            }
Example #11
0
        public void SetAction(BtnEvent pAction, string pPkValue)
        {
            fAction = pAction;

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

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

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

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

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

            this.LoadData();
        }
        private static List <Contacttype> EntityList(string q)
        {
            List <Contacttype> list = new List <Contacttype>();

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    Contacttype obj = new Contacttype()
                    {
                        Contacttype_id   = redr[CONTACTTYPE.CONTACTTYPE_ID].ToString(),
                        Contacttype_name = redr[CONTACTTYPE.CONTACTTYPE_NAME].ToString(),
                        Notes            = redr[CONTACTTYPE.NOTES].ToString(),
                        Active_id        = redr[CONTACTTYPE.ACTIVE_ID].ToString(),
                        User_id          = redr[USER.USER_NAME].ToString()
                    };

                    list.Add(obj);
                }

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