Пример #1
0
        private static List <Po> EntityList(string q)
        {
            List <Po> list = new List <Po>();

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    Po obj = new Po()
                    {
                        Po_id         = redr[PO.PO_ID].ToString(),
                        Po_no         = redr[PO.PO_NO].ToString(),
                        Po_date       = redr[PO.PO_DATE].ToString(),
                        Delivery_date = redr[PO.DELIVERY_DATE].ToString(),
                        Notes         = redr[PO.NOTES].ToString(),
                        Active_id     = redr[PO.ACTIVE_ID].ToString(),
                        User_id       = redr[USER.USER_NAME].ToString()
                    };

                    list.Add(obj);
                }

                redr.Close();
            }
            return(list);
        }
Пример #2
0
        public static string GetName_Id(string v)
        {
            Po obj = PKId(v);

            if (obj != null)
            {
                return(obj.Po_no);
            }
            return("");
        }
Пример #3
0
        public static string GetId_Name(string v)
        {
            Po obj = SearchName(v);

            if (obj != null)
            {
                return(obj.Po_id);
            }
            return("");
        }
Пример #4
0
 private static string AttachParams(string q, Po v)
 {
     q = q.Replace("@" + PO.PO_ID + "@", "" + ConvertTO.SqlString(v.Po_id) + "");
     q = q.Replace("@" + PO.PO_NO + "@", "" + ConvertTO.SqlString(v.Po_no) + "");
     q = q.Replace("@" + PO.PO_DATE + "@", "" + ConvertTO.SqlDate(v.Po_date) + "");
     q = q.Replace("@" + PO.DELIVERY_DATE + "@", "" + ConvertTO.SqlDate(v.Delivery_date) + "");
     q = q.Replace("@" + PO.NOTES + "@", "" + ConvertTO.SqlString(v.Notes) + "");
     q = q.Replace("@" + PO.ACTIVE_ID + "@", "" + ConvertTO.SqlString(v.Active_id) + "");
     q = q.Replace("@" + PO.USER_ID + "@", "" + ConvertTO.SqlString(v.User_id) + "");
     return(q);
 }
Пример #5
0
        public static void Update(Po v, DAL dalsession)
        {
            string q = "UPDATE " + PO.PO_TBL + " SET";

            q += " " + PO.PO_NO + " = @" + PO.PO_NO + "@ \r\n ";
            q += "," + PO.PO_DATE + " = @" + PO.PO_DATE + "@ \r\n ";
            q += "," + PO.DELIVERY_DATE + " = @" + PO.DELIVERY_DATE + "@ \r\n ";
            q += "," + PO.NOTES + " = @" + PO.NOTES + "@ \r\n ";
            q += "," + PO.ACTIVE_ID + " = @" + PO.ACTIVE_ID + "@ \r\n ";
            q += "," + PO.USER_ID + " = @" + PO.USER_ID + "@ \r\n ";
            q += "  WHERE " + PO.PO_ID + " = @" + PO.PO_ID + "@ ";
            q  = AttachParams(q, v);
            dalsession.Execute(q);
        }
Пример #6
0
        private Po CollectData()
        {
            Po fobj = new Po()
            {
                Po_id         = vId,
                Po_no         = txt_po_no.Text,
                Po_date       = txt_po_date.Text,
                Delivery_date = txt_delivery_date.Text,
                Active_id     = Core.Stative,
                Notes         = txt_notes.Text,
                User_id       = Current.User
            };

            return(fobj);
        }
Пример #7
0
        public static void Insert(Po v, DAL dalsession)
        {
            string q = " INSERT INTO " + PO.PO_TBL + " ( ";

            q += " " + PO.PO_NO + " \r\n ";
            q += "," + PO.PO_DATE + " \r\n ";
            q += "," + PO.DELIVERY_DATE + " \r\n ";
            q += "," + PO.NOTES + " \r\n ";
            q += "," + PO.ACTIVE_ID + " \r\n ";
            q += "," + PO.USER_ID + " \r\n ";
            q += " ) VALUES ( ";
            q += "  @" + PO.PO_NO + "@ \r\n ";
            q += ", @" + PO.PO_DATE + "@ \r\n ";
            q += ", @" + PO.DELIVERY_DATE + "@ \r\n ";
            q += ", @" + PO.NOTES + "@ \r\n ";
            q += ", @" + PO.ACTIVE_ID + "@ \r\n ";
            q += ", @" + PO.USER_ID + "@ \r\n ";
            q += " ) \r\n ";
            q  = AttachParams(q, v);
            dalsession.Execute(q);
        }
Пример #8
0
        public void SetAction(BtnEvent action, string pk)
        {
            fAction = action;

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

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

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

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

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

            this.LoadData();
        }