示例#1
0
        /// <summary>
        /// 创建产品索引
        /// </summary>
        private void CreateProductIndex(string indexPath)
        {
            Product_BLL productBll = new Product_BLL();
            LuceneNet   lucene     = new LuceneNet(indexPath);
            var         products   = productBll.GetProduct();

            #region 需要添加到索引的字段
            var needCreateField = new Dictionary <string, bool>();
            needCreateField.Add(Utilities.GetPropertyName <Product>(f => f.PID), false);
            needCreateField.Add(Utilities.GetPropertyName <Product>(f => f.Description), false);
            needCreateField.Add(Utilities.GetPropertyName <Product>(f => f.Name), true);
            needCreateField.Add(Utilities.GetPropertyName <Product>(f => f.IsBest), false);
            needCreateField.Add(Utilities.GetPropertyName <Product>(f => f.IsHot), false);
            needCreateField.Add(Utilities.GetPropertyName <Product>(f => f.IsNew), false);
            needCreateField.Add(Utilities.GetPropertyName <Product>(f => f.IsRecommend), false);
            needCreateField.Add(Utilities.GetPropertyName <Product>(f => f.MarketPrice), false);
            needCreateField.Add(Utilities.GetPropertyName <Product>(f => f.OfficialGuarantee), false);
            needCreateField.Add(Utilities.GetPropertyName <Product>(f => f.SaleCount), false);
            needCreateField.Add(Utilities.GetPropertyName <Product>(f => f.ShowImg), false);
            #endregion
            var isCreateSuccess = lucene.CreateIndexByData <Product>(products, needCreateField, true);
            if (!isCreateSuccess)
            {
                //如果索引没有创建成功通知管理员
            }
        }
        public ActionResult AddNewMRN(int?id)
        {
            if (Session["LOGGEDIN"] != null)
            {
                objMRNVM_Property = new MRNVM_Property();
                Vendors_Property vendor        = new Vendors_Property();
                Product_Property product       = new Product_Property();
                Vendors_BLL      objvendorbll  = new Vendors_BLL();
                Product_BLL      objProductbll = new Product_BLL();

                //objMRNVM_Property.VendorLST = Helper.ConvertDataTable<Vendors_Property>(objvendorbll.ViewAll());
                objMRNVM_Property.ProductList   = Helper.ConvertDataTable <Product_Property>(objProductbll.ViewAll());
                objMRNVM_Property.WareHouseList = Helper.ConvertDataTable <WareHouse_Property>(ViewWareHouses());
                objMRNVM_Property.mrnDate       = DateTime.Now.ToString("yyyy-MM-dd");

                if (id > 0)
                {
                    //update
                    LP_MRN_Detail_Property objmrndetail;
                    objMRNProperty     = new LP_MRN_Master_Property();
                    objMRNProperty.idx = Convert.ToInt16(id);

                    objMRNBll = new LP_MRN_BLL(objMRNProperty);
                    DataTable dt = objMRNBll.SelectById();
                    objMRNVM_Property.idx          = Convert.ToInt16(dt.Rows[0]["mrnIdx"].ToString());
                    objMRNVM_Property.description  = dt.Rows[0]["description"].ToString();
                    objMRNVM_Property.WarerHouseID = Convert.ToInt32(dt.Rows[0]["WarerHouseID"].ToString());

                    objMRNVM_Property.mrNumber = dt.Rows[0]["mrNumber"].ToString();
                    objMRNVM_Property.mrnDate  = DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd");
                    //foreach(DataRow dr in dt.Rows)
                    //{
                    //    objmrndetail

                    //}
                    ViewBag.DetailData = Helper.ConvertDataTable <MRNVM_Property>(dt);

                    return(View("AddNewMRN", objMRNVM_Property));
                }
                else
                {
                    objMRNBll = new LP_MRN_BLL();
                    LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property();
                    objtrans.TableName         = "MRN";
                    objtrans.Identityfieldname = "idx";
                    objtrans.userid            = Session["UID"].ToString();
                    objMRNVM_Property.mrNumber = objMRNBll.GenerateMRNNo(objtrans);
                    return(View("AddNewMRN", objMRNVM_Property));
                }
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
示例#3
0
        public ActionResult ReturnSales(int?id)
        {
            if (Session["LOGGEDIN"] != null)
            {
                objSalesOrderVM_Property = new SalesOrderVM_Property();
                Customers_Property vendor          = new Customers_Property();
                Product_Property   product         = new Product_Property();
                Customers_BLL      objcustomerbll  = new Customers_BLL();
                Product_BLL        objProductbll   = new Product_BLL();
                LP_Quotation_BLL   objQuotationbll = new LP_Quotation_BLL();
                WareHouse_BLL      objWareHouseBLL = new WareHouse_BLL();
                objSalesOrderVM_Property.idx           = Convert.ToInt32(id);
                objSalesOrderVM_Property.QSList        = Helper.ConvertDataTable <LP_Quotation_Master_Property>(objQuotationbll.SelectQS());
                objSalesOrderVM_Property.CustomerLST   = Helper.ConvertDataTable <Customers_Property>(objcustomerbll.ViewAllCustomers());
                objSalesOrderVM_Property.ProductList   = Helper.ConvertDataTable <Product_Property>(objProductbll.ViewAll());
                objSalesOrderVM_Property.BankList      = Helper.ConvertDataTable <Company_Bank_Property>(GetAllCompanyBanks());
                objSalesOrderVM_Property.wareHouseList = Helper.ConvertDataTable <WareHouse_Property>(objWareHouseBLL.SelectAll());

                objSalesOrderVM_Property.salesorderDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
                Taxes_Property obj       = new Taxes_Property();
                Taxes_BLL      objtaxBLL = new Taxes_BLL(obj);
                ViewBag.TaxList = Helper.ConvertDataTable <Taxes_Property>(objtaxBLL.GetTaxesForCheckBox());
                //objPInvoiceVM = new LP_PI_ViewModel();
                //objPIProperty = new LP_P_Invoice_Property();
                //objPIProperty.idx = Convert.ToInt32(id);
                //objPIBLL = new LP_PInvoice_BLL(objPIProperty);
                //objPInvoiceVM.TaxesList = Helper.ConvertDataTable<Taxes_Property>(GetAllTaxes());
                //objPInvoiceVM.ProductList = Helper.ConvertDataTable<Product_Property>(ViewAllProducts());
                //objPInvoiceVM.BankList = Helper.ConvertDataTable<Company_Bank_Property>(GetAllCompanyBanks());
                DataSet DS = objSalesOrderBll.SelectSIWithDetailData(objSalesOrderVM_Property.idx);
                //DataSet DS = objPIBLL.SelectPIWithDetailData(objPIProperty.idx);
                if (DS.Tables.Count > 0)
                {
                    ViewBag.isReturn = 1;
                    objSalesOrderVM_Property.SalesOrderDetailLST = Helper.ConvertDataTable <SalesOrdersDetails_Property>(DS.Tables[0]);
                    if (DS.Tables[1].Rows.Count > 0)
                    {
                        objSalesOrderVM_Property.salesTaxesLST = Helper.ConvertDataTable <LP_salesTaxes_Property>(DS.Tables[1]);
                    }
                }

                return(View("AddNewSalesOrder", objSalesOrderVM_Property));
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
示例#4
0
        public JsonResult AddUpdate(Product_Property objProductCategory)
        {
            if (Session["LOGGEDIN"] != null)
            {
                try
                { if (objProductCategory.productTypeIdx == 2)

                  {
                      objProductCategory.DetailData = Helper.ToDataTable <LP_ProductDetailsForCombo_Property>(objProductCategory.ProductDetailLST);
                  }

                  if (objProductCategory.idx > 0)
                  {
                      objProductCategory.lastModifiedByUserIdx = Convert.ToInt32(Session["UID"].ToString());
                      objProductCategory.lastModificationDate  = DateTime.Now.ToString("dd/MM/yyyy");
                      objProductBLL = new Product_BLL(objProductCategory);

                      bool flag = objProductBLL.Update();
                      return(Json(new { data = "Updated", success = flag, statuscode = 200 }, JsonRequestBehavior.AllowGet));
                  }
                  else
                  {
                      //objProductCategory.companyIdx = 1;
                      objProductCategory.createdByUserIdx = Convert.ToInt32(Session["UID"].ToString());
                      objProductCategory.TableName        = "productDetailsForCombo";
                      objProductBLL = new Product_BLL(objProductCategory);
                      //if (objProductCategory.isMainBranch == 1)
                      //{
                      //    var check = objProductCategory.MainBranch();
                      //    if (check.Rows.Count > 0)
                      //    {
                      //        return Json(new { data = "Main Branch Already Exist", success = false, statuscode = 500 }, JsonRequestBehavior.AllowGet);
                      //    }
                      //}

                      bool flag = objProductBLL.Insert();
                      return(Json(new { data = "Inserted", success = flag, statuscode = 200 }, JsonRequestBehavior.AllowGet));
                  } }
                catch (Exception ex)
                {
                    return(Json(new { data = ex.Message, success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(new { data = "Session Expired", success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet));
            }
        }
示例#5
0
        public JsonResult Delete(int?id)
        {
            if (Session["LOGGEDIN"] != null)
            {
                try
                {
                    if (id > 0)
                    {
                        Product_Property branchProperty = new Product_Property();
                        branchProperty.idx = int.Parse(id.ToString());
                        objProductBLL      = new Product_BLL(id);
                        Product_BLL branhcBll = new Product_BLL(branchProperty);
                        var         flag1     = branhcBll.Delete(id);
                        //if (flag1.Rows.Count > 0)
                        //{
                        if (true)
                        {
                            bool flag = objProductBLL.Delete(id);
                            return(Json(new { data = "Deleted", success = flag, statuscode = 200 }, JsonRequestBehavior.AllowGet));
                        }
                        //else
                        //{
                        //    return Json(new { data = "Mian Branch Cannot be Delete ", success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet);
                        //}

                        //}
                        // return Json(new { data = "Process Completed ", success = true, statuscode = 200 }, JsonRequestBehavior.AllowGet);
                    }
                    else
                    {
                        return(Json(new { data = "Error Occur", success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet));
                    }
                }
                catch (Exception ex)
                {
                    return(Json(new { data = ex.Message, success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(new { data = "Session Expired", success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet));
            }
        }
示例#6
0
 //public DataTable GetAllHSCodes()
 //{
 //    objProduct = new Product_BLL();
 //    return objProduct.ViewAll();
 //}
 public DataTable ViewAllProduct()
 {
     if (Session["LOGGEDIN"] != null)
     {
         try
         {
             Product_Property objProductProperty = new Product_Property();
             //objProductProperty.branchIdx = 1;//user logged in session branchIdx
             Product_BLL objProductBLL = new Product_BLL(objProductProperty);
             return(objProductBLL.ViewAll());
         }
         catch (Exception ex)
         {
             return(new DataTable());
         }
     }
     else
     {
         return(new DataTable());
     }
 }
示例#7
0
 public JsonResult GetAllProducts()
 {
     if (Session["LOGGEDIN"] != null)
     {
         try
         {
             objProductProperty = new Product_Property();
             //objProductProperty.branchIdx = 1;//user logged in session branchIdx
             objProductBLL = new Product_BLL(objProductProperty);
             var Data = JsonConvert.SerializeObject(objProductBLL.ViewAll());
             return(Json(new { data = Data, success = true, statuscode = 200, count = Data.Length }, JsonRequestBehavior.AllowGet));
         }
         catch (Exception ex)
         {
             return(Json(new { data = ex.Message, success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet));
         }
     }
     else
     {
         return(Json(new { data = "Session Expired", success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet));
     }
 }
示例#8
0
        public ActionResult AddQuotaion(int?id)
        {
            if (Session["LOGGEDIN"] != null)
            {
                objQuotationVM_Property = new QuotationVM_Property();

                Customers_Property customer       = new Customers_Property();
                Product_Property   product        = new Product_Property();
                Customers_BLL      objcustomerbll = new Customers_BLL();
                Product_BLL        objProductbll  = new Product_BLL();
                objQuotationVM_Property.CustomerLST = Helper.ConvertDataTable <Customers_Property>(objcustomerbll.ViewAllCustomers());
                objQuotationVM_Property.ProductList = Helper.ConvertDataTable <Product_Property>(objProductbll.ViewAll());
                Taxes_Property obj       = new Taxes_Property();
                Taxes_BLL      objtaxBLL = new Taxes_BLL(obj);
                ViewBag.TaxList = Helper.ConvertDataTable <Taxes_Property>(objtaxBLL.GetTaxesForCheckBox());
                //objQuotationVM_Property.QuotationDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
                ////objQuotationVM_Property.poNumber = "Po-001";
                if (id > 0)
                {
                    LP_Quotation_Detail_Property objmQuotationdetail;
                    objQuotationProperty     = new LP_Quotation_Master_Property();
                    objQuotationProperty.idx = Convert.ToInt16(id);

                    objquotationBll = new LP_Quotation_BLL(objQuotationProperty);
                    DataTable dt = objquotationBll.SelectOne();
                    objQuotationVM_Property.idx         = Convert.ToInt16(dt.Rows[0]["quotationIdx"].ToString());
                    objQuotationVM_Property.customerIdx = Convert.ToInt16(dt.Rows[0]["customerIdx"].ToString());
                    objQuotationVM_Property.qsNumber    = dt.Rows[0]["qsNumber"].ToString();
                    objQuotationVM_Property.description = dt.Rows[0]["description"].ToString();

                    objQuotationVM_Property.totalAmount = Convert.ToDecimal(dt.Rows[0]["totalAmount"].ToString());
                    string pdate = (dt.Rows[0]["quotationDate"].ToString()).ToString();
                    string ndate = DateTime.Parse(pdate).ToString("yyyy-MM-dd");
                    objQuotationVM_Property.quotationDate = Convert.ToDateTime(ndate);// DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd");
                    //DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd");
                    //foreach(DataRow dr in dt.Rows)
                    //{
                    //    objmrndetail

                    //}
                    ViewBag.DetailData = Helper.ConvertDataTable <QuotationVM_Property>(dt);
                    //update
                    return(View("AddQuotaion", objQuotationVM_Property));//objQuotationVM_Property
                }
                else
                {
                    objQuotationVM_Property.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString());
                    objquotationBll = new LP_Quotation_BLL();
                    LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property();
                    objtrans.TableName               = "quotation";
                    objtrans.Identityfieldname       = "idx";
                    objtrans.userid                  = Session["UID"].ToString();
                    objQuotationVM_Property.qsNumber = objquotationBll.GeneratePO(objtrans);

                    return(View("AddQuotaion", objQuotationVM_Property));//, objQuotationVM_Property
                }
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
示例#9
0
        public ActionResult AddNewPurchase(int?id)
        {
            if (Session["LOGGEDIN"] != null)
            {
                objPurchaseVM_Property = new PurchaseVM_Property();
                Vendors_Property vendor        = new Vendors_Property();
                Product_Property product       = new Product_Property();
                Vendors_BLL      objvendorbll  = new Vendors_BLL();
                Product_BLL      objProductbll = new Product_BLL();
                LP_MRN_BLL       objMRNbll     = new LP_MRN_BLL();
                objPurchaseVM_Property.MRList         = Helper.ConvertDataTable <LP_MRN_Master_Property>(objMRNbll.SelectMRN());
                objPurchaseVM_Property.VendorLST      = Helper.ConvertDataTable <Vendors_Property>(objvendorbll.ViewAll());
                objPurchaseVM_Property.DepartmentList = Helper.ConvertDataTable <Departments_property>(GetAllDepartments());

                objPurchaseVM_Property.ProductList  = Helper.ConvertDataTable <Product_Property>(objProductbll.ViewAll());
                objPurchaseVM_Property.purchaseDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
                //objPurchaseVM_Property.poNumber = "Po-001";
                if (id > 0)
                {
                    LP_Purchase_Detail_Property objmpurchasedetail;
                    objPurchaseProperty     = new LP_Purchase_Master_Property();
                    objPurchaseProperty.idx = Convert.ToInt16(id);

                    objpurchaseBll = new LP_Purchase_BLL(objPurchaseProperty);
                    DataTable dt = objpurchaseBll.SelectOne();
                    objPurchaseVM_Property.idx          = Convert.ToInt16(dt.Rows[0]["purchaseIdx"].ToString());
                    objPurchaseVM_Property.vendorIdx    = Convert.ToInt16(dt.Rows[0]["vendorIdx"].ToString());
                    objPurchaseVM_Property.poNumber     = dt.Rows[0]["poNumber"].ToString();
                    objPurchaseVM_Property.description  = dt.Rows[0]["description"].ToString();
                    objPurchaseVM_Property.MRNIdx       = Convert.ToInt16(dt.Rows[0]["MRNIdx"].ToString());
                    objPurchaseVM_Property.DepartmentID = Convert.ToInt16(dt.Rows[0]["DepartmentID"].ToString());
                    objPurchaseVM_Property.totalAmount  = Convert.ToDecimal(dt.Rows[0]["totalAmount"].ToString());
                    string pdate = (dt.Rows[0]["purchaseDate"].ToString()).ToString();
                    string ndate = DateTime.Parse(pdate).ToString("yyyy-MM-dd");
                    objPurchaseVM_Property.purchaseDate = Convert.ToDateTime(ndate);// DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd");
                    //DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd");
                    //foreach(DataRow dr in dt.Rows)
                    //{
                    //    objmrndetail

                    //}
                    ViewBag.DetailData = Helper.ConvertDataTable <PurchaseVM_Property>(dt);
                    //update
                    return(View("AddNewPurchase", objPurchaseVM_Property));
                }
                else
                {
                    //objPurchaseProperty = new LP_Purchase_Master_Property();
                    objPurchaseVM_Property.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString());
                    objpurchaseBll = new LP_Purchase_BLL();
                    LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property();
                    objtrans.TableName              = "purchase";
                    objtrans.Identityfieldname      = "idx";
                    objtrans.userid                 = Session["UID"].ToString();
                    objPurchaseVM_Property.poNumber = objpurchaseBll.GeneratePO(objtrans);
                    //objPurchaseProperty.poNumber = "";
                    //objpurchaseBll = new LP_Purchase_BLL(objPurchaseProperty);
                    //objPurchaseVM_Property.poNumber = objpurchaseBll.GeneratePO();// "PO-001";
                    // string po = objpurchaseBll.GeneratePO();

                    return(View("AddNewPurchase", objPurchaseVM_Property));
                }
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
示例#10
0
        public ActionResult AddNewSalesOrder(int?id)
        {
            if (Session["LOGGEDIN"] != null)
            {
                objSalesOrderVM_Property = new SalesOrderVM_Property();
                Customers_Property vendor          = new Customers_Property();
                Product_Property   product         = new Product_Property();
                Customers_BLL      objcustomerbll  = new Customers_BLL();
                Product_BLL        objProductbll   = new Product_BLL();
                LP_Quotation_BLL   objQuotationbll = new LP_Quotation_BLL();
                WareHouse_BLL      objWareHouseBLL = new WareHouse_BLL();
                objSalesOrderVM_Property.QSList        = Helper.ConvertDataTable <LP_Quotation_Master_Property>(objQuotationbll.SelectQS());
                objSalesOrderVM_Property.CustomerLST   = Helper.ConvertDataTable <Customers_Property>(objcustomerbll.ViewAllCustomers());
                objSalesOrderVM_Property.ProductList   = Helper.ConvertDataTable <Product_Property>(objProductbll.ViewAll());
                objSalesOrderVM_Property.BankList      = Helper.ConvertDataTable <Company_Bank_Property>(GetAllCompanyBanks());
                objSalesOrderVM_Property.wareHouseList = Helper.ConvertDataTable <WareHouse_Property>(objWareHouseBLL.SelectAll());

                objSalesOrderVM_Property.salesorderDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
                Taxes_Property obj       = new Taxes_Property();
                Taxes_BLL      objtaxBLL = new Taxes_BLL(obj);
                ViewBag.TaxList = Helper.ConvertDataTable <Taxes_Property>(objtaxBLL.GetTaxesForCheckBox());
                //objSalesOrderVM_Property.poNumber = "Po-001";
                if (id > 0)
                {
                    LP_SalesOrder_Detail_Property objmSalesOrderdetail;
                    objSalesOrderProperty     = new LP_SalesOrder_Master_Property();
                    objSalesOrderProperty.idx = Convert.ToInt16(id);

                    objSalesOrderBll = new LP_SalesOrder_BLL(objSalesOrderProperty);
                    DataTable dt = objSalesOrderBll.SelectOne();
                    objSalesOrderVM_Property.idx         = Convert.ToInt16(dt.Rows[0]["salesorderIdx"].ToString());
                    objSalesOrderVM_Property.customerIdx = Convert.ToInt32(dt.Rows[0]["customerIdx"].ToString());
                    objSalesOrderVM_Property.soNumber    = dt.Rows[0]["soNumber"].ToString();
                    objSalesOrderVM_Property.description = dt.Rows[0]["description"].ToString();
                    objSalesOrderVM_Property.qsIdx       = Convert.ToInt16(dt.Rows[0]["qsIdx"].ToString());
                    objSalesOrderVM_Property.totalAmount = Convert.ToDecimal(dt.Rows[0]["totalAmount"].ToString());
                    string pdate = (dt.Rows[0]["salesorderdate"].ToString()).ToString();
                    string ndate = DateTime.Parse(pdate).ToString("yyyy-MM-dd");
                    objSalesOrderVM_Property.salesorderDate = Convert.ToDateTime(ndate);// DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd");
                    //DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd");
                    //foreach(DataRow dr in dt.Rows)
                    //{
                    //    objmrndetail

                    //}
                    ViewBag.DetailData = Helper.ConvertDataTable <SalesOrderVM_Property>(dt);
                    //update
                    return(View("AddNewSalesOrder", objSalesOrderVM_Property));
                }
                else
                {
                    //objSalesOrderProperty = new LP_SalesOrder_Master_Property();
                    objSalesOrderVM_Property.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString());
                    objSalesOrderBll = new LP_SalesOrder_BLL();
                    LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property();
                    objtrans.TableName         = "SalesOrder";
                    objtrans.Identityfieldname = "idx";
                    objtrans.userid            = Session["UID"].ToString();

                    objSalesOrderVM_Property.soNumber = objSalesOrderBll.GenerateSO(objtrans);
                    //objSalesOrderProperty.poNumber = "";
                    //objSalesOrderBll = new LP_SalesOrder_BLL(objSalesOrderProperty);
                    //objSalesOrderVM_Property.poNumber = objSalesOrderBll.GeneratePO();// "PO-001";
                    // string po = objSalesOrderBll.GeneratePO();

                    return(View("AddNewSalesOrder", objSalesOrderVM_Property));
                }
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
示例#11
0
        public ActionResult AddNewProduct(int?id)
        {
            if (Session["LOGGEDIN"] != null)
            {
                objProductProperty     = new Product_Property();
                objProductProperty.idx = Convert.ToInt32(id);
                //objProductProperty.branchIdx = 1;//It will have the value of session branchIdx
                objProductBLL = new Product_BLL(objProductProperty);
                DataTable categories = objProductBLL.ddlCategory();
                List <Product_Category_Property> catLST = new List <Product_Category_Property>();
                DataTable subCategories = objProductBLL.ddlSubCategory();
                List <Product_SubCategory_Property> subCatLST = new List <Product_SubCategory_Property>();
                DataTable productTypes = objProductBLL.ddlProductType();
                List <Product_Type_Property> productTypeLST = new List <Product_Type_Property>();
                DataTable units = objProductBLL.ddlUnit();
                List <itemUnit_Property> unitLST = new List <itemUnit_Property>();
                foreach (DataRow dr in categories.Rows)
                {
                    Product_Category_Property objProductCat = new Product_Category_Property();
                    objProductCat.Category = dr["category"].ToString();
                    objProductCat.idx      = Convert.ToInt32(dr["idx"].ToString());
                    catLST.Add(objProductCat);
                }
                ViewBag.catLST = catLST;
                foreach (DataRow dr in subCategories.Rows)
                {
                    Product_SubCategory_Property objProductCat = new Product_SubCategory_Property();
                    objProductCat.subCategory = dr["subCategory"].ToString();
                    objProductCat.idx         = Convert.ToInt32(dr["idx"].ToString());
                    subCatLST.Add(objProductCat);
                }
                ViewBag.subCatLST = subCatLST;
                foreach (DataRow dr in productTypes.Rows)
                {
                    Product_Type_Property objProductCat = new Product_Type_Property();
                    objProductCat.productType = dr["productType"].ToString();
                    objProductCat.idx         = Convert.ToInt32(dr["idx"].ToString());
                    productTypeLST.Add(objProductCat);
                }
                ViewBag.productTypeLST = productTypeLST;
                foreach (DataRow dr in units.Rows)
                {
                    itemUnit_Property objProductCat = new itemUnit_Property();
                    objProductCat.itemUnit = dr["itemUnit"].ToString();
                    objProductCat.idx      = Convert.ToInt32(dr["idx"].ToString());
                    unitLST.Add(objProductCat);
                }
                ViewBag.unitLST = unitLST;
                if (id != null && id != 0)
                {
                    decimal cp, sp, pt;
                    var     dt = objProductBLL.GetById(id);
                    //objProductProperty.companyIdx = 1;
                    objProductProperty.idx              = int.Parse(dt.Rows[0]["idx"].ToString());
                    objProductProperty.productTypeIdx   = int.Parse(dt.Rows[0]["productTypeIdx"].ToString());
                    objProductProperty.productCatIdx    = int.Parse(dt.Rows[0]["productCatIdx"].ToString());
                    objProductProperty.productSubCatIdx = int.Parse(dt.Rows[0]["productSubCatIdx"].ToString());
                    objProductProperty.unitIdx          = int.Parse(dt.Rows[0]["unitIdx"].ToString());
                    objProductProperty.HSCODE           = (dt.Rows[0]["HSCODE"].ToString());
                    objProductProperty.itemCode         = (dt.Rows[0]["itemCode"].ToString());
                    objProductProperty.itemName         = (dt.Rows[0]["itemName"].ToString());
                    objProductProperty.description      = (dt.Rows[0]["description"].ToString());
                    //objProductProperty.costPrice = 0.00m;
                    string costPrice = (dt.Rows[0]["costPrice"].ToString());
                    decimal.TryParse(costPrice, out cp);
                    objProductProperty.costPrice = cp;
                    string salePrice = (dt.Rows[0]["salePrice"].ToString());
                    decimal.TryParse(salePrice, out sp);
                    objProductProperty.salePrice = sp;
                    string productTax = (dt.Rows[0]["productTax"].ToString());
                    decimal.TryParse(productTax, out pt);
                    objProductProperty.productTax = pt;
                    //objProductProperty.product_catIdx = int.Parse(dt.Rows[0]["product_catIdx"].ToString());
                    //objProductProperty.subCategory = dt.Rows[0]["subCategory"].ToString();
                    //objProductProperty.HS_CodeSub = dt.Rows[0]["HS_CodeSub"].ToString();
                    ////objProductProperty.firstName = dt.Rows[0]["firstName"].ToString();
                    //objProductProperty.lastName = dt.Rows[0]["lastName"].ToString();
                    //objProductProperty.CNIC = (dt.Rows[0]["CNIC"].ToString());
                    //objProductProperty.cellNumber = (dt.Rows[0]["cellNumber"].ToString());
                    //objProductProperty.loginId = (dt.Rows[0]["loginId"].ToString());
                    //objProductProperty.password = dt.Rows[0]["password"].ToString();
                }
                else
                {
                    LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property();
                    objtrans.TableName          = "products";
                    objtrans.Identityfieldname  = "idx";
                    objtrans.userid             = Session["UID"].ToString();
                    objProductProperty.itemCode = objProductBLL.GenerateProductCode(objtrans);
                }


                return(PartialView("_AddNewProduct", objProductProperty));
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
示例#12
0
        public ActionResult AddNewConsigment(int?id)
        {
            if (Session["LOGGEDIN"] != null)
            {
                objConsigmentVm = new LP_Consigment_ViewModel();
                Vendors_Property vendor        = new Vendors_Property();
                Product_Property product       = new Product_Property();
                Vendors_BLL      objvendorbll  = new Vendors_BLL();
                Product_BLL      objProductbll = new Product_BLL();

                objpurchaseBll = new LP_PI_BLL();
                // objPurchaseVM_Property.VendorLST = Helper.ConvertDataTable<Vendors_Property>(objvendorbll.ViewAll());
                // objPurchaseVM_Property.DepartmentList = Helper.ConvertDataTable<Departments_property>(GetAllDepartments());
                // objPurchaseVM_Property.PurchaseType_List = Helper.ConvertDataTable<LP_Purchase_Type>(GetAllPurchaseType());
                objConsigmentVm.ProductList = Helper.ConvertDataTable <Product_Property>(objProductbll.ViewAll());
                objConsigmentVm.CIPO        = Helper.ConvertDataTable <LP_CI_PurchaseOrder_Property>(objpurchaseBll.SelectAllCIPO());

                objConsigmentVm.Invoicedate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
                //objPurchaseVM_Property.poNumber = "Po-001";
                if (id > 0)
                {
                    //LP_Purchase_Detail_Property objmpurchasedetail;
                    //objPurchaseProperty = new LP_Performa_Invoice_Property();
                    //objPurchaseProperty.idx = Convert.ToInt16(id);

                    //objpurchaseBll = new LP_PI_BLL();
                    //DataTable dt = objpurchaseBll.SelectOne();
                    //objPurchaseVM_Property.idx = Convert.ToInt16(dt.Rows[0]["purchaseIdx"].ToString());
                    //objPurchaseVM_Property.vendorIdx = Convert.ToInt16(dt.Rows[0]["vendorIdx"].ToString());
                    //objPurchaseVM_Property.poNumber = dt.Rows[0]["poNumber"].ToString();
                    //objPurchaseVM_Property.description = dt.Rows[0]["description"].ToString();

                    //objPurchaseVM_Property.DepartmentID = Convert.ToInt16(dt.Rows[0]["DepartmentID"].ToString());
                    //objPurchaseVM_Property.totalAmount = Convert.ToDecimal(dt.Rows[0]["totalAmount"].ToString());
                    //string pdate = (dt.Rows[0]["purchaseDate"].ToString()).ToString();
                    //string ndate = DateTime.Parse(pdate).ToString("yyyy-MM-dd");
                    //objPurchaseVM_Property.purchaseDate = Convert.ToDateTime(ndate);// DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd");
                    ////DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd");
                    ////foreach(DataRow dr in dt.Rows)
                    ////{
                    ////    objmrndetail

                    ////}
                    //ViewBag.DetailData = Helper.ConvertDataTable<PurchaseVM_Property>(dt);
                    //update
                    return(View("AddNewConsigment", objConsigmentVm));
                }
                else
                {
                    //objPurchaseProperty = new LP_Purchase_Master_Property();
                    objConsigmentVm.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString());
                    objpurchaseBll = new LP_PI_BLL();
                    LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property();
                    objtrans.TableName         = "consigment";
                    objtrans.Identityfieldname = "idx";
                    objtrans.userid            = Session["UID"].ToString();
                    objConsigmentVm.InvoiceNo  = objpurchaseBll.GenerateCINo(objtrans);
                    //objCIPOVm.CDPercntage = 20;
                    //objCIPOVm.RDPercentage = 20;
                    //objCIPOVm.ACDPercentage = 20;
                    //objCIPOVm.STPercentage = 20;
                    //objCIPOVm.ITPercentage = 20;
                    //objCIPOVm.TDTax = 0.00m;
                    //objCIPOVm.CleaningPrice = 0.00m;
                    //objCIPOVm.TotalPrice = 0.00m;
                    //objCIPOVm.ASTPercentage = 20;
                    //objCIPOVm.CleaningPrice = 20;
                    //objPurchaseProperty.poNumber = "";
                    //objpurchaseBll = new LP_Purchase_BLL(objPurchaseProperty);
                    //objPurchaseVM_Property.poNumber = objpurchaseBll.GeneratePO();// "PO-001";
                    // string po = objpurchaseBll.GeneratePO();

                    return(View("AddNewConsigment", objConsigmentVm));
                }
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }