예제 #1
0
        private static List <Hsncode> EntityList(string q)
        {
            List <Hsncode> list = new List <Hsncode>();

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    Hsncode obj = new Hsncode()
                    {
                        Hsncode_id   = redr[HSNCODE.HSNCODE_ID].ToString(),
                        Hsncode_name = redr[HSNCODE.HSNCODE_NAME].ToString(),
                        Description  = redr[HSNCODE.DESCRIPTION].ToString(),
                        Notes        = redr[HSNCODE.NOTES].ToString(),
                        Active_id    = redr[HSNCODE.ACTIVE_ID].ToString(),
                        User_id      = redr[USER.USER_NAME].ToString()
                    };

                    list.Add(obj);
                }

                redr.Close();
            }
            return(list);
        }
예제 #2
0
 private static void InsertData(Hsncode obj, string newDB)
 {
     if (CheckData(obj, newDB) == false)
     {
         CHsncode.Insert(obj, new DAL());
     }
     ;
 }
예제 #3
0
        public static string GetId_Name(string _pName)
        {
            Hsncode obj = SearchName(_pName, new DAL());

            if (obj != null)
            {
                return(obj.Hsncode_id);
            }
            return("");
        }
예제 #4
0
        public static string GetName_Id(string _pId)
        {
            Hsncode obj = PKId(_pId, new DAL());

            if (obj != null)
            {
                return(obj.Hsncode_name);
            }
            return("");
        }
예제 #5
0
 private static string AttachParams(string q, Hsncode v)
 {
     q = q.Replace("@" + HSNCODE.HSNCODE_ID + "@", "" + ConvertTO.SqlString(v.Hsncode_id) + "");
     q = q.Replace("@" + HSNCODE.HSNCODE_NAME + "@", "" + ConvertTO.SqlString(v.Hsncode_name) + "");
     q = q.Replace("@" + HSNCODE.DESCRIPTION + "@", "" + ConvertTO.SqlString(v.Description) + "");
     q = q.Replace("@" + HSNCODE.NOTES + "@", "" + ConvertTO.SqlString(v.Notes) + "");
     q = q.Replace("@" + HSNCODE.ACTIVE_ID + "@", "" + ConvertTO.SqlString(v.Active_id) + "");
     q = q.Replace("@" + HSNCODE.USER_ID + "@", "" + ConvertTO.SqlString(v.User_id) + "");
     return(q);
 }
예제 #6
0
        public static void Update(Hsncode v, DAL dalsession)
        {
            string q = "UPDATE " + HSNCODE.HSNCODE_TBL + " SET";

            q += " " + HSNCODE.HSNCODE_NAME + " = @" + HSNCODE.HSNCODE_NAME + "@ \r\n ";
            q += "," + HSNCODE.DESCRIPTION + " = @" + HSNCODE.DESCRIPTION + "@ \r\n ";
            q += "," + HSNCODE.NOTES + " = @" + HSNCODE.NOTES + "@ \r\n ";
            q += "," + HSNCODE.ACTIVE_ID + " = @" + HSNCODE.ACTIVE_ID + "@ \r\n ";
            q += "," + HSNCODE.USER_ID + " = @" + HSNCODE.USER_ID + "@ \r\n ";
            q += "  WHERE " + HSNCODE.HSNCODE_ID + " = @" + HSNCODE.HSNCODE_ID + "@ ";
            q  = AttachParams(q, v);
            dalsession.Execute(q);
        }
예제 #7
0
        private Hsncode CollectData()
        {
            Hsncode fobj = new Hsncode()
            {
                Hsncode_id   = vId,
                Hsncode_name = txt_hsncode_name.Text,
                Description  = txt_description.Text,
                Active_id    = Core.Stative,
                Notes        = txt_notes.Text,
                User_id      = Current.User
            };

            return(fobj);
        }
예제 #8
0
        public static void Insert(Hsncode v, DAL dalsession)
        {
            string q = " INSERT INTO " + HSNCODE.HSNCODE_TBL + " ( ";

            q += " " + HSNCODE.HSNCODE_NAME + " \r\n ";
            q += "," + HSNCODE.DESCRIPTION + " \r\n ";
            q += "," + HSNCODE.NOTES + " \r\n ";
            q += "," + HSNCODE.ACTIVE_ID + " \r\n ";
            q += "," + HSNCODE.USER_ID + " \r\n ";
            q += " ) VALUES ( ";
            q += "  @" + HSNCODE.HSNCODE_NAME + "@ \r\n ";
            q += ", @" + HSNCODE.DESCRIPTION + "@ \r\n ";
            q += ", @" + HSNCODE.NOTES + "@ \r\n ";
            q += ", @" + HSNCODE.ACTIVE_ID + "@ \r\n ";
            q += ", @" + HSNCODE.USER_ID + "@ \r\n ";
            q += " ) \r\n ";
            q  = AttachParams(q, v);
            dalsession.Execute(q);
        }
예제 #9
0
        private static bool CheckData(Hsncode obj, string newDB)
        {
            string q = "USE " + newDB + "; ";

            q += "SELECT * FROM " + HSNCODE.HSNCODE_TBL + " WHERE " + HSNCODE.HSNCODE_NAME + " = '" + obj.Hsncode_name + "'; ";

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    obj.Hsncode_id = redr[HSNCODE.HSNCODE_ID].ToString();

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

                    return(true);
                }
                return(false);
            }
        }
예제 #10
0
        public void SetAction(BtnEvent pAction, string pPkValue)
        {
            fAction = pAction;

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

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

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

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

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

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

            q += "SELECT * FROM " + HSNCODE.HSNCODE_TBL + " WHERE " + HSNCODE.HSNCODE_ID + " = '" + id + "'; ";

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    Hsncode obj = new Hsncode
                    {
                        Hsncode_name = redr[HSNCODE.HSNCODE_NAME].ToString(),
                        Description  = redr[HSNCODE.DESCRIPTION].ToString(),
                        Notes        = redr[HSNCODE.NOTES].ToString(),
                        Active_id    = redr[HSNCODE.ACTIVE_ID].ToString(),
                        User_id      = "1"
                    };

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