Beispiel #1
0
        private static List <Cash_receipt> EntityList(string q)
        {
            List <Cash_receipt> list = new List <Cash_receipt>();

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    Cash_receipt obj = new Cash_receipt()
                    {
                        Cash_receipt_id = redr[CASH_RECEIPT.CASH_RECEIPT_ID].ToString(),
                        Receipt_date    = redr[CASH_RECEIPT.RECEIPT_DATE].ToString(),
                        Party_id        = redr[PARTY.PARTY_NAME].ToString(),
                        Purpose         = redr[CASH_RECEIPT.PURPOSE].ToString(),
                        Receipt_amount  = ConvertTO.Decimal(redr[CASH_RECEIPT.RECEIPT_AMOUNT].ToString()),
                        Notes           = redr[CASH_RECEIPT.NOTES].ToString(),
                        Active_id       = redr[CASH_RECEIPT.ACTIVE_ID].ToString(),
                        User_id         = redr[USER.USER_NAME].ToString()
                    };

                    list.Add(obj);
                }

                redr.Close();
            }
            return(list);
        }
Beispiel #2
0
        public static string GetId_Name(string v)
        {
            Cash_receipt obj = SearchName(v);

            if (obj != null)
            {
                return(obj.Cash_receipt_id);
            }
            return("");
        }
Beispiel #3
0
        public static string GetName_Id(string v)
        {
            Cash_receipt obj = PKId(v);

            if (obj != null)
            {
                return(obj.Cash_receipt_id);
            }
            return("");
        }
Beispiel #4
0
 private static string AttachParams(string q, Cash_receipt v)
 {
     q = q.Replace("@" + CASH_RECEIPT.CASH_RECEIPT_ID + "@", "" + ConvertTO.SqlString(v.Cash_receipt_id) + "");
     q = q.Replace("@" + CASH_RECEIPT.RECEIPT_DATE + "@", "" + ConvertTO.SqlDate(v.Receipt_date) + "");
     q = q.Replace("@" + CASH_RECEIPT.PARTY_ID + "@", "" + ConvertTO.SqlString(v.Party_id) + "");
     q = q.Replace("@" + CASH_RECEIPT.PURPOSE + "@", "" + ConvertTO.SqlString(v.Purpose) + "");
     q = q.Replace("@" + CASH_RECEIPT.RECEIPT_AMOUNT + "@", "" + ConvertTO.SqlDecimal(v.Receipt_amount) + "");
     q = q.Replace("@" + CASH_RECEIPT.NOTES + "@", "" + ConvertTO.SqlString(v.Notes) + "");
     q = q.Replace("@" + CASH_RECEIPT.ACTIVE_ID + "@", "" + ConvertTO.SqlString(v.Active_id) + "");
     q = q.Replace("@" + CASH_RECEIPT.USER_ID + "@", "" + ConvertTO.SqlString(v.User_id) + "");
     return(q);
 }
Beispiel #5
0
        public static void Update(Cash_receipt v, DAL dalsession)
        {
            string q = "UPDATE " + CASH_RECEIPT.CASH_RECEIPT_TBL + " SET";

            q += " " + CASH_RECEIPT.RECEIPT_DATE + " = @" + CASH_RECEIPT.RECEIPT_DATE + "@ \r\n ";
            q += "," + CASH_RECEIPT.PARTY_ID + " = @" + CASH_RECEIPT.PARTY_ID + "@ \r\n ";
            q += "," + CASH_RECEIPT.PURPOSE + " = @" + CASH_RECEIPT.PURPOSE + "@ \r\n ";
            q += "," + CASH_RECEIPT.RECEIPT_AMOUNT + " = @" + CASH_RECEIPT.RECEIPT_AMOUNT + "@ \r\n ";
            q += "," + CASH_RECEIPT.NOTES + " = @" + CASH_RECEIPT.NOTES + "@ \r\n ";
            q += "," + CASH_RECEIPT.ACTIVE_ID + " = @" + CASH_RECEIPT.ACTIVE_ID + "@ \r\n ";
            q += "," + CASH_RECEIPT.USER_ID + " = @" + CASH_RECEIPT.USER_ID + "@ \r\n ";
            q += "  WHERE " + CASH_RECEIPT.CASH_RECEIPT_ID + " = @" + CASH_RECEIPT.CASH_RECEIPT_ID + "@ ";
            q  = AttachParams(q, v);
            dalsession.Execute(q);
        }
Beispiel #6
0
        private Cash_receipt CollectData()
        {
            Cash_receipt fobj = new Cash_receipt()
            {
                Cash_receipt_id = vId,
                Receipt_date    = txt_receipt_date.Text,
                Party_id        = CParty_exten.GetId_Name(txt_party_id.Text),
                Purpose         = txt_purpose.Text,
                Receipt_amount  = ConvertTO.Decimal(txt_receipt_amount.Text),
                Active_id       = Core.Stative,
                Notes           = txt_notes.Text,
                User_id         = Current.User
            };

            return(fobj);
        }
Beispiel #7
0
        public void SetAction(BtnEvent action, string pk)
        {
            fAction = action;

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

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

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

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

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

            this.LoadData();
        }
Beispiel #8
0
        public static void Insert(Cash_receipt v, DAL dalsession)
        {
            string q = " INSERT INTO " + CASH_RECEIPT.CASH_RECEIPT_TBL + " ( ";

            q += " " + CASH_RECEIPT.RECEIPT_DATE + " \r\n ";
            q += "," + CASH_RECEIPT.PARTY_ID + " \r\n ";
            q += "," + CASH_RECEIPT.PURPOSE + " \r\n ";
            q += "," + CASH_RECEIPT.RECEIPT_AMOUNT + " \r\n ";
            q += "," + CASH_RECEIPT.NOTES + " \r\n ";
            q += "," + CASH_RECEIPT.ACTIVE_ID + " \r\n ";
            q += "," + CASH_RECEIPT.USER_ID + " \r\n ";
            q += " ) VALUES ( ";
            q += "  @" + CASH_RECEIPT.RECEIPT_DATE + "@ \r\n ";
            q += ", @" + CASH_RECEIPT.PARTY_ID + "@ \r\n ";
            q += ", @" + CASH_RECEIPT.PURPOSE + "@ \r\n ";
            q += ", @" + CASH_RECEIPT.RECEIPT_AMOUNT + "@ \r\n ";
            q += ", @" + CASH_RECEIPT.NOTES + "@ \r\n ";
            q += ", @" + CASH_RECEIPT.ACTIVE_ID + "@ \r\n ";
            q += ", @" + CASH_RECEIPT.USER_ID + "@ \r\n ";
            q += " ) \r\n ";
            q  = AttachParams(q, v);
            dalsession.Execute(q);
        }