Exemplo n.º 1
0
 private static void InsertData(Product obj, string newDB)
 {
     if (CheckData(obj, newDB) == false)
     {
         obj.Product_name   = Checks.Escape(obj.Product_name);
         obj.Producttype_id = CProducttype_exten.GetId_Name(obj.Producttype_id);
         obj.Hsncode_id     = CHsncode_exten.GetId_Name(obj.Hsncode_id);
         obj.Unit_id        = CUnit_exten.GetId_Name(obj.Unit_id);
         CProduct.Insert(obj, new DAL());
     }
     ;
 }
Exemplo n.º 2
0
        public void List_Option(ListOption pAction)
        {
            fAction = pAction;

            switch (fAction)
            {
            case ListOption.active:

                if (chk_notactive.Checked == true)
                {
                    LoadData(CUnit_exten.NotActive(new DAL()));
                }
                else
                {
                    LoadData(CUnit_exten.Active(new DAL()));
                }

                break;

            case ListOption.notactive:

                if (chk_notactive.Checked == true)
                {
                    LoadData(CUnit_exten.NotActive(new DAL()));
                }
                else
                {
                    LoadData(CUnit_exten.Active(new DAL()));
                }

                break;

            case ListOption.Search:
                if (txt_unit_name.Text != "")
                {
                    List <Unit> list = new List <Unit>
                    {
                        CUnit_exten.SearchName(txt_unit_name.Text, new DAL())
                    };
                    LoadData(list);
                }
                else
                {
                    LoadData(CUnit_exten.Active(new DAL()));
                }
                break;

            default:
                LoadData(CUnit_exten.Active(new DAL()));
                break;
            }
        }
Exemplo n.º 3
0
        public void SetAction(BtnEvent pAction, string pPkValue)
        {
            fAction = pAction;

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

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

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

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

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

            this.LoadData();
        }
Exemplo n.º 4
0
        private static bool CheckData(Product obj, string newDB)
        {
            string q = "USE " + newDB + "; ";

            q += "SELECT * FROM " + PRODUCT.PRODUCT_TBL + " WHERE " + PRODUCT.PRODUCT_NAME + " = '" + obj.Product_name + "'; ";

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    obj.Product_id = redr[PRODUCT.PRODUCT_ID].ToString();

                    obj.Product_name   = Checks.Escape(obj.Product_name);
                    obj.Producttype_id = CProducttype_exten.GetId_Name(obj.Producttype_id);
                    obj.Hsncode_id     = CHsncode_exten.GetId_Name(obj.Hsncode_id);
                    obj.Unit_id        = CUnit_exten.GetId_Name(obj.Unit_id);
                    CProduct.Update(obj, new DAL());

                    return(true);
                }
                return(false);
            }
        }
Exemplo n.º 5
0
        private Product CollectData()
        {
            Product fobj = new Product()
            {
                Product_id     = vId,
                Product_name   = Checks.Escape(txt_product_name.Text),
                Producttype_id = CProducttype_exten.GetId_Name(txt_producttype_id.Text),
                Hsncode_id     = CHsncode_exten.GetId_Name(txt_hsncode_id.Text),
                Unit_id        = CUnit_exten.GetId_Name(txt_unit_id.Text),
                Purchase_price = ConvertTO.Decimal(txt_purchase_price.Text),
                Selling_price  = ConvertTO.Decimal(txt_selling_price.Text),
                Sgst_percent   = txt_sgst_percent.Text,
                Cgst_percent   = txt_cgst_percent.Text,
                Igst_percent   = txt_igst_percent.Text,
                Opening_stock  = ConvertTO.Decimal(txt_opening_stock.Text),
                Opening_price  = ConvertTO.Decimal(txt_opening_price.Text),
                Active_id      = Core.Stative,
                Notes          = txt_notes.Text,
                User_id        = Current.User
            };

            if ((fobj.Producttype_id == null) || (fobj.Producttype_id == ""))
            {
                fobj.Producttype_id = "1";
            }
            if ((fobj.Hsncode_id == null) || (fobj.Hsncode_id == ""))
            {
                fobj.Hsncode_id = "1";
            }
            if ((fobj.Unit_id == null) || (fobj.Unit_id == ""))
            {
                fobj.Unit_id = "1";
            }

            return(fobj);
        }
Exemplo n.º 6
0
 void Txt_unit_LookupUpdate(object sender, EventArgs e)
 {
     txt_unit_id.LookupList = CUnit_exten.GetforLookup(new DAL());
 }