Example #1
0
        public ActionResult AddNewVendors(int?id)
        {
            objVendorsProperty     = new Vendors_Property();
            objVendorsProperty.idx = Convert.ToInt32(id);
            //objVendorsProperty.branchIdx = 1;//It will have the value of session branchIdx
            objVendorsBLL = new Vendors_BLL(objVendorsProperty);
            DataTable categories = objVendorsBLL.ddlCategory();
            List <Vendor_Category_Property> catLST = new List <Vendor_Category_Property>();

            DataTable VendorTypes = objVendorsBLL.ddlVendorsType();
            List <VendorType_Property> VendorTypeLST = new List <VendorType_Property>();

            foreach (DataRow dr in categories.Rows)
            {
                Vendor_Category_Property objVendorsCat = new Vendor_Category_Property();
                objVendorsCat.vendorCategory = dr["vendorCategory"].ToString();
                objVendorsCat.idx            = Convert.ToInt32(dr["idx"].ToString());
                catLST.Add(objVendorsCat);
            }
            ViewBag.catLST = catLST;

            foreach (DataRow dr in VendorTypes.Rows)
            {
                VendorType_Property objVendorsCat = new VendorType_Property();
                objVendorsCat.vendorType = dr["vendorType"].ToString();
                objVendorsCat.idx        = Convert.ToInt32(dr["idx"].ToString());
                VendorTypeLST.Add(objVendorsCat);
            }
            ViewBag.VendorsTypeLST = VendorTypeLST;
            if (id != null && id != 0)
            {
                var dt = objVendorsBLL.GetById(id);
                //objVendorsProperty.companyIdx = 1;
                objVendorsProperty.idx           = int.Parse(dt.Rows[0]["idx"].ToString());
                objVendorsProperty.vendorTypeIdx = int.Parse(dt.Rows[0]["vendorTypeIdx"].ToString());
                objVendorsProperty.vendorCatIdx  = int.Parse(dt.Rows[0]["vendorCatIdx"].ToString());

                objVendorsProperty.contact    = (dt.Rows[0]["contact"].ToString());
                objVendorsProperty.vendorCode = (dt.Rows[0]["vendorCode"].ToString());
                objVendorsProperty.vendorName = (dt.Rows[0]["vendorName"].ToString());
                objVendorsProperty.address    = (dt.Rows[0]["address"].ToString());
                return(PartialView("_AddNewVendors", objVendorsProperty));
            }

            else
            {
                objVendorsProperty.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString());
                objVendorsBLL = new Vendors_BLL();
                LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property();
                objtrans.TableName         = "vendors";
                objtrans.Identityfieldname = "idx";
                objtrans.userid            = Session["UID"].ToString();

                objVendorsProperty.vendorCode = objVendorsBLL.GenerateSO(objtrans);
                return(PartialView("_AddNewVendors", objVendorsProperty));
            }
        }
Example #2
0
        public ActionResult AddNewVendors(int?id)
        {
            objVendorsProperty     = new Vendors_Property();
            objVendorsProperty.idx = Convert.ToInt32(id);
            //objVendorsProperty.branchIdx = 1;//It will have the value of session branchIdx
            objVendorsBLL = new Vendors_BLL(objVendorsProperty);
            DataTable categories = objVendorsBLL.ddlCategory();
            List <Vendor_Category_Property> catLST = new List <Vendor_Category_Property>();

            DataTable VendorTypes = objVendorsBLL.ddlVendorsType();
            List <VendorType_Property> VendorTypeLST = new List <VendorType_Property>();

            foreach (DataRow dr in categories.Rows)
            {
                Vendor_Category_Property objVendorsCat = new Vendor_Category_Property();
                objVendorsCat.vendorCategory = dr["vendorCategory"].ToString();
                objVendorsCat.idx            = Convert.ToInt32(dr["idx"].ToString());
                catLST.Add(objVendorsCat);
            }
            ViewBag.catLST = catLST;

            foreach (DataRow dr in VendorTypes.Rows)
            {
                VendorType_Property objVendorsCat = new VendorType_Property();
                objVendorsCat.vendorType = dr["vendorType"].ToString();
                objVendorsCat.idx        = Convert.ToInt32(dr["idx"].ToString());
                VendorTypeLST.Add(objVendorsCat);
            }
            ViewBag.VendorsTypeLST = VendorTypeLST;

            if (id != null && id != 0)
            {
                var dt = objVendorsBLL.GetById(id);
                //objVendorsProperty.companyIdx = 1;
                objVendorsProperty.idx           = int.Parse(dt.Rows[0]["idx"].ToString());
                objVendorsProperty.vendorTypeIdx = int.Parse(dt.Rows[0]["vendorTypeIdx"].ToString());
                objVendorsProperty.vendorCatIdx  = int.Parse(dt.Rows[0]["vendorCatIdx"].ToString());

                //objVendorsProperty.unitIdx = int.Parse(dt.Rows[0]["unitIdx"].ToString());
                objVendorsProperty.contact    = (dt.Rows[0]["contact"].ToString());
                objVendorsProperty.vendorCode = (dt.Rows[0]["vendorCode"].ToString());
                objVendorsProperty.vendorName = (dt.Rows[0]["vendorName"].ToString());
                objVendorsProperty.address    = (dt.Rows[0]["address"].ToString());
                //objVendorsProperty.Vendors_catIdx = int.Parse(dt.Rows[0]["Vendors_catIdx"].ToString());
                //objVendorsProperty.subCategory = dt.Rows[0]["subCategory"].ToString();
                //objVendorsProperty.HS_CodeSub = dt.Rows[0]["HS_CodeSub"].ToString();
                ////objVendorsProperty.firstName = dt.Rows[0]["firstName"].ToString();
                //objVendorsProperty.lastName = dt.Rows[0]["lastName"].ToString();
                //objVendorsProperty.CNIC = (dt.Rows[0]["CNIC"].ToString());
                //objVendorsProperty.cellNumber = (dt.Rows[0]["cellNumber"].ToString());
                //objVendorsProperty.loginId = (dt.Rows[0]["loginId"].ToString());
                //objVendorsProperty.password = dt.Rows[0]["password"].ToString();
            }


            return(PartialView("_AddNewVendors", objVendorsProperty));
        }
Example #3
0
 public VendorType_DAL(VendorType_Property objVendor_Type)
 {
     objVendorType = objVendor_Type;
 }
Example #4
0
 public VendorType_BLL(VendorType_Property objVendorType_Property)
 {
     objVendorCategoryProperty = objVendorType_Property;
 }