Exemplo n.º 1
0
        public static string ListProducts(string OrganizationCode, string SelectedProduct)
        {
            List <ProductInfo> products = null;

            System.Text.StringBuilder sbProducList = new System.Text.StringBuilder();

            try
            {
                if (System.Web.HttpContext.Current.Session["ProductList"] == null)
                {
                    if (System.Web.HttpContext.Current.Session["Language"] == null)
                    {
                        System.Web.HttpContext.Current.Session["Language"] = 0;
                    }

                    if (System.Web.HttpContext.Current.Session["UserDetails"] != null && ((UserInfo)System.Web.HttpContext.Current.Session["UserDetails"]).UserType.ToString().Trim().ToUpper() == "R" && ((UserInfo)System.Web.HttpContext.Current.Session["UserDetails"]).OrganizationCode != null)
                    {
                        OrganizationCode = ((UserInfo)System.Web.HttpContext.Current.Session["UserDetails"]).OrganizationCode.Trim();
                    }

                    products = new Product_Svc.ProductServiceClient().GetList_Product("", "", "", OrganizationCode, "", false, System.Web.HttpContext.Current.Session["Language"].ToString());
                    System.Web.HttpContext.Current.Session["ProductList"] = products;
                }
                else
                {
                    products = (List <ProductInfo>)System.Web.HttpContext.Current.Session["ProductList"];
                }
            }
            catch (Exception ex)
            {
                ErrorLog.LogErrors_Comments(ex.Message + ex.InnerException + ex.StackTrace, "Controler", "Country ist", "");
                products = new List <ProductInfo>();
            }

            sbProducList.AppendLine("<option value=\"\">Select one</option>");

            if (products != null && products.Count > 0)
            {
                foreach (ProductInfo state in products)
                {
                    if (!string.IsNullOrEmpty(SelectedProduct) && state.ProductId.Trim() == SelectedProduct.Trim())
                    {
                        sbProducList.AppendLine("<option value=\"" + state.ProductId + "\" selected=\"selected\">" + state.ProductName + "</option>");
                    }
                    else
                    {
                        sbProducList.AppendLine("<option value=\"" + state.ProductId + "\">" + state.ProductName + "</option>");
                    }
                }
            }

            return(sbProducList.ToString());
        }
        public ActionResult Save_ProductOrganization(string isOnlyDelete, string OrganizationproductId, string ProductId, string CategoryId, string CountryId, string OrganizationCode, string IsActive,
                                                     string Name, string Description, string SKU, string Unit, string Class, string AbatementPercentage, string ServiceType,
                                                     string SalePrice, string isInclusiveTax, string AvailableQty, string IncomeAccount, string SupplierId,
                                                     string PreferredSupplierId, string ReverseCharge, string PurchaseTax, string SaleTax)
        {
            if (Session["UserDetails"] != null && ((UserInfo)Session["UserDetails"]).UserType.ToString().Trim().ToUpper() == "R" && ((UserInfo)Session["UserDetails"]).OrganizationCode != null)
            {
                OrganizationCode = ((UserInfo)Session["UserDetails"]).OrganizationCode.Trim();
            }

            using (Product_Svc.ProductServiceClient iGstSvc = new Product_Svc.ProductServiceClient())
            {
                // Modified on [3rd August 2019] by [Partha] cause [Giving NULL reference exception
                // when Organisation Code is null] - Start
                if (OrganizationproductId == null)
                {
                    OrganizationproductId = "";
                }
                // End: Modified on [3rd August 2019]
                ProductOrganiztionInfo objProduct = new ProductOrganiztionInfo();
                objProduct.OrganizationproductId = OrganizationproductId.Trim().Length == 0 ? 0 : Convert.ToInt32(OrganizationproductId.Trim());
                objProduct.ProductId             = ProductId;
                objProduct.CategoryId            = CategoryId;
                objProduct.CountryId             = CountryId;
                objProduct.OrganizationCode      = OrganizationCode;
                objProduct.IsActive = IsActive.Trim().ToUpper();

                objProduct.Name                = Name;
                objProduct.Description         = Description;
                objProduct.ServiceType         = ServiceType.Trim().Length > 0 ? Convert.ToInt32(ServiceType) : 0;
                objProduct.SKU                 = SKU;
                objProduct.Unit                = Unit.Trim().Length == 0 ? 0 : Convert.ToInt32(Unit);
                objProduct.Class               = Class.Trim().Length == 0 ? 0 : Convert.ToInt32(Class);
                objProduct.AbatementPercentage = AbatementPercentage.Trim().Length == 0 ? 0 : Convert.ToInt32(AbatementPercentage);
                objProduct.SalePrice           = SalePrice.Trim().Length == 0 ? 0 : Convert.ToInt32(SalePrice);
                objProduct.isInclusiveTax      = isInclusiveTax.Trim().ToUpper() == "Y";
                objProduct.AvailableQty        = AvailableQty.Trim().Length == 0 ? 0 : Convert.ToInt32(AvailableQty);
                objProduct.IncomeAccount       = IncomeAccount;
                objProduct.SupplierId          = SupplierId.Trim().Length == 0 ? 0 : Convert.ToInt32(SupplierId);
                objProduct.PreferredSupplierId = PreferredSupplierId.Trim().Length == 0 ? 0 : Convert.ToInt32(PreferredSupplierId);
                objProduct.ReverseCharge       = ReverseCharge.Trim().Length == 0 ? 0 : Convert.ToInt32(ReverseCharge);
                objProduct.PurchaseTax         = PurchaseTax.Trim().Length == 0 ? 0 : Convert.ToInt32(PurchaseTax);
                objProduct.SaleTax             = SaleTax.Trim().Length == 0 ? 0 : Convert.ToInt32(SaleTax);


                if (iGstSvc.Save_ProductOrganization(isOnlyDelete.Trim().ToUpper() == "Y", objProduct, ((UserInfo)Session["UserDetails"]), out ErrorMessage))
                {
                    return(Json("Ok", JsonRequestBehavior.AllowGet));
                }
            }

            return(Json(ErrorMessage, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        public static string ListOrganizationProducts(string SelectedOrganization, string SelectedOrganizationproductId)
        {
            List <ProductOrganiztionInfo> Organizations = null;

            System.Text.StringBuilder sbOrganizationList = new System.Text.StringBuilder();

            try
            {
                string OrganizationCode = "";
                if (System.Web.HttpContext.Current.Session["UserDetails"] != null && ((UserInfo)System.Web.HttpContext.Current.Session["UserDetails"]).UserType.ToString().Trim().ToUpper() == "R" && ((UserInfo)System.Web.HttpContext.Current.Session["UserDetails"]).OrganizationCode != null)
                {
                    OrganizationCode = ((UserInfo)System.Web.HttpContext.Current.Session["UserDetails"]).OrganizationCode.Trim();
                }

                if (System.Web.HttpContext.Current.Session["ProductOrganiztion"] == null)
                {
                    // Modified on [30th August 2019] by [Partha] cause [Adding isExpense parameter]
                    Organizations = new Product_Svc.ProductServiceClient().GetList_ProductOrganization("", "", "", SelectedOrganization, "", true, "0");
                    // END: Modified on[30th August 2019] by[Partha]
                    System.Web.HttpContext.Current.Session["ProductOrganiztion"] = Organizations;
                }
                else
                {
                    Organizations = (List <ProductOrganiztionInfo>)System.Web.HttpContext.Current.Session["ProductOrganiztion"];
                }
            }
            catch (Exception ex)
            {
                ErrorLog.LogErrors_Comments(ex.Message + ex.InnerException + ex.StackTrace, "Controler", "Organization ist", "");
                Organizations = new List <ProductOrganiztionInfo>();
            }

            sbOrganizationList.AppendLine("<option value=\"\">Select one</option>");

            if (Organizations != null && Organizations.Count > 0)
            {
                foreach (ProductOrganiztionInfo country in Organizations)
                {
                    if (!string.IsNullOrEmpty(SelectedOrganizationproductId) && country.OrganizationproductId.ToString().Trim() == SelectedOrganizationproductId.Trim())
                    {
                        sbOrganizationList.AppendLine("<option value=\"" + country.OrganizationproductId + "\" selected=\"selected\">" + country.ProductName + "</option>");
                    }
                    else
                    {
                        sbOrganizationList.AppendLine("<option value=\"" + country.OrganizationproductId + "\">" + country.ProductName + "</option>");
                    }
                }
            }

            return(sbOrganizationList.ToString());
        }
        public ActionResult GetList_ProductOrganizationImage(string ImageId, string OrganizationproductId, string ProductID, string IsActive, string IsMain)
        {
            using (iGst_Svc.GSTServiceClient iGstSvc = new iGst_Svc.GSTServiceClient())
            {
                List <ProductOrganiztionImageInfo> list = new Product_Svc.ProductServiceClient().GetList_ProductOrganizationImage(ImageId, OrganizationproductId, "", "", IsMain);

                if (list != null && list.Count > 0 && list[0].ImageId > 0)
                {
                    return(Json(list, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json("NO", JsonRequestBehavior.AllowGet));
                }
            }
        }
        public ActionResult GetList_Product(string IsExpense)
        {
            if (Session["Language"] == null)
            {
                Session["Language"] = 0;
            }

            string OrganizationCode = "";

            if (Session["UserDetails"] != null && ((UserInfo)Session["UserDetails"]).UserType.ToString().Trim().ToUpper() == "R" && ((UserInfo)Session["UserDetails"]).OrganizationCode != null)
            {
                OrganizationCode = ((UserInfo)Session["UserDetails"]).OrganizationCode.Trim();
            }

            using (Product_Svc.ProductServiceClient iGstSvc = new Product_Svc.ProductServiceClient())
            {
                return(View("~/Views/MasterPages/ProductList.cshtml", iGstSvc.GetList_Product("", "", "", OrganizationCode, "", true, Session["Language"].ToString())));
            }
        }
        public ActionResult Save_Product(string isOnlyDelete, string ProductId, string CategoryId, string CountryId, string ProductName, string IsActive)
        {
            using (Product_Svc.ProductServiceClient iGstSvc = new Product_Svc.ProductServiceClient())
            {
                ProductInfo objProduct = new ProductInfo();
                objProduct.ProductId   = ProductId;
                objProduct.CategoryId  = CategoryId;
                objProduct.CountryId   = CountryId;
                objProduct.ProductName = ProductName;
                objProduct.IsActive    = IsActive.Trim().ToUpper() == "Y";

                if (iGstSvc.Save_Product(isOnlyDelete.Trim().ToUpper() == "Y", objProduct, ((UserInfo)Session["UserDetails"]), out ErrorMessage))
                {
                    return(Json("Ok", JsonRequestBehavior.AllowGet));
                }
            }

            return(Json(ErrorMessage, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 7
0
        public ActionResult GetList_MyExpense()
        {
            if (Session["Language"] == null)
            {
                Session["Language"] = 0;
            }

            string OrganizationCode = "";

            if (Session["UserDetails"] != null && ((UserInfo)Session["UserDetails"]).UserType.ToString().Trim().ToUpper() == "R" && ((UserInfo)Session["UserDetails"]).OrganizationCode != null)
            {
                OrganizationCode = ((UserInfo)Session["UserDetails"]).OrganizationCode.Trim();
            }

            using (Product_Svc.ProductServiceClient iGstSvc = new Product_Svc.ProductServiceClient())
            {
                // Modified on [30th August 2019] by [Partha] cause [Adding isExpense parameter]
                return(View("~/Views/MasterPages/MyExpenseList.cshtml", iGstSvc.GetList_ProductOrganization("", "", "", OrganizationCode, "", true, Session["Language"].ToString())));
                // END: Modified on[30th August 2019] by[Partha]
            }
        }
        public ActionResult GetDetails_ProductOrganizationAddEdit(string OrganizationproductId, string org)
        {
            if (Session["Language"] == null)
            {
                Session["Language"] = 0;
            }

            if (Session["UserDetails"] != null && ((UserInfo)Session["UserDetails"]).UserType.ToString().Trim().ToUpper() == "R" && ((UserInfo)Session["UserDetails"]).OrganizationCode != null)
            {
                org = ((UserInfo)Session["UserDetails"]).OrganizationCode.Trim();
            }

            using (iGst_Svc.GSTServiceClient iGstSvc = new iGst_Svc.GSTServiceClient())
            {
                // Modified on [30th August 2019] by [Partha] cause [Adding isExpense parameter]
                var list = new Product_Svc.ProductServiceClient().GetList_ProductOrganization(OrganizationproductId, "", "", org, "", true, Session["Language"].ToString());
                // END: Modified on[30th August 2019] by[Partha]

                if (string.IsNullOrEmpty(org) && (list != null && list[0] != null) && list[0].OrganizationCode != null)
                {
                    org = list[0].OrganizationCode;
                }


                ViewBag.Organizations = CommonMethods.ListOrganizations(org);

                ViewBag.Customers         = CommonMethods.ListSupplier(org, list[0].SupplierId.ToString());
                ViewBag.PreferedSuppliers = CommonMethods.ListSupplier(org, list[0].SupplierId.ToString());
                ViewBag.IncomeAccounts    = CommonMethods.ListBanks(org, (list != null && list[0] != null) && list[0].IncomeAccount != null ? list[0].IncomeAccount : "");
                ViewBag.Categories        = CommonMethods.ListCategory((list != null && list[0] != null) && list[0].CategoryId != null ? list[0].CategoryId : "", "0");
                ViewBag.ServiceUnits      = CommonMethods.ListServiceUnit(list[0].Unit.ToString());
                ViewBag.ServiceTypes      = CommonMethods.ListServiceType(list[0].ServiceType.ToString());
                ViewBag.ServiceClasses    = CommonMethods.ListServiceClass(list[0].Class.ToString());

                return(PartialView("~/Views/MasterPages/ProductOrganizationAddEdit.cshtml", list[0]));
            }
        }
        public ActionResult GetDetails_ProductOrganization(string org)
        {
            if (Session["Language"] == null)
            {
                Session["Language"] = 0;
            }

            if (Session["UserDetails"] != null && ((UserInfo)Session["UserDetails"]).UserType.ToString().Trim().ToUpper() == "R" && ((UserInfo)Session["UserDetails"]).OrganizationCode != null)
            {
                org = ((UserInfo)Session["UserDetails"]).OrganizationCode.Trim();
            }

            using (Product_Svc.ProductServiceClient iGstSvc = new Product_Svc.ProductServiceClient())
            {
                List <ProductOrganiztionInfo> list = iGstSvc.GetDetails_ProductOrganization("", "", "", org, "", true, Session["Language"].ToString());

                if (list != null && list.Count() > 0)
                {
                    ViewBag.Organizations = CommonMethods.ListOrganizations(org);
                }

                return(PartialView("~/Views/MasterPages/ProductOrganizationDetails.cshtml", list));
            }
        }
Exemplo n.º 10
0
        public ActionResult UploadFile(string type, bool Overwrite)
        {
            using (iGst_Svc.GSTServiceClient iGstSvc = new iGst_Svc.GSTServiceClient())
            {
                bool bReturn = false;
                var  result  = new { Success = "False", Message = "Error Message" };

                string OrganizationCode = "1";

                if (((UserInfo)Session["UserDetails"]).UserType == "R")
                {
                    OrganizationCode = ((UserInfo)Session["UserDetails"]).OrganizationCode;
                }

                try
                {
                    for (int i = 0; i < Request.Files.Count; i++)
                    {
                        System.Data.DataSet ds = GetDataSet_Excel(Request.Files[0], out ErrorMessage);

                        if (ErrorMessage.Trim().Length > 0)
                        {
                            result = new { Success = "False", Message = ErrorMessage };
                            return(Json(result, JsonRequestBehavior.AllowGet));
                        }

                        bool flag = false;

                        if (type == "C")
                        {
                            new Bill_Svc.BillServiceClient().Upload_Customer("C", Overwrite, ds, OrganizationCode, ((UserInfo)Session["UserDetails"]).UserCode, out bReturn, out ErrorMessage);
                            if (ErrorMessage.Trim().Length == 0)
                            {
                                flag = true;
                            }
                        }
                        else if (type == "S")
                        {
                            new Bill_Svc.BillServiceClient().Upload_Customer("S", Overwrite, ds, OrganizationCode, ((UserInfo)Session["UserDetails"]).UserCode, out bReturn, out ErrorMessage);
                            if (ErrorMessage.Trim().Length == 0)
                            {
                                flag = true;
                            }
                        }
                        else if (type == "CA")
                        {
                            flag = new Master_Svc.MasterServiceClient().Upload_Category(Overwrite, ds, ((UserInfo)Session["UserDetails"]).UserCode, out bReturn, out ErrorMessage);
                        }
                        else if (type == "P")
                        {
                            flag = new Product_Svc.ProductServiceClient().Upload_Product(Overwrite, ds, ((UserInfo)Session["UserDetails"]), out bReturn, out ErrorMessage);
                        }
                        else if (type == "BT")
                        {
                            flag = new Master_Svc.MasterServiceClient().Upload_BankTransaction(Overwrite, false, ds, "", OrganizationCode, ((UserInfo)Session["UserDetails"]), out bReturn, out ErrorMessage);
                        }

                        if (ErrorMessage.Trim().Length > 0)
                        {
                            result = new { Success = "False", Message = ErrorMessage };
                            return(Json(result, JsonRequestBehavior.AllowGet));
                        }
                        else if (!flag)
                        {
                            result = new { Success = "False", Message = "No upload activity has been processed." };
                            return(Json(result, JsonRequestBehavior.AllowGet));
                        }
                    }
                }
                catch (Exception ex)
                {
                    result = new { Success = "False", Message = "Error in Uploading file. Please cocntact with the authority" + ex.Message };
                    return(Json(result, JsonRequestBehavior.AllowGet));
                }

                result = new { Success = "True", Message = "Data uploaded" };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult Save_ProductOrganizationImage(string isOnlyDelete, string ImageId, string OrganizationproductId, string ProductId, string IsMain, string IsActive, HttpPostedFileBase[] files)
        {
            string fileName = "", path = "";

            using (Product_Svc.ProductServiceClient iGstSvc = new Product_Svc.ProductServiceClient())
            {
                ProductOrganiztionImageInfo objProduct = null;

                if (files == null && isOnlyDelete.Trim().ToUpper() == "Y")
                {
                    objProduct = new ProductOrganiztionImageInfo();

                    objProduct.OrganizationproductId = OrganizationproductId.Trim().Length == 0 ? 0 : Convert.ToInt32(OrganizationproductId.Trim());
                    objProduct.ProductId             = ProductId;
                    objProduct.ImageId  = ImageId.Trim().Length == 0 ? 0 : Convert.ToInt32(ImageId);
                    objProduct.IsActive = IsActive.Trim().ToUpper();
                    objProduct.Ismain   = IsMain.Trim().ToUpper();
                    objProduct.IsActive = IsActive.Trim().ToUpper();

                    if (iGstSvc.Save_ProductOrganizationImage(isOnlyDelete.Trim().ToUpper() == "Y", objProduct, ((UserInfo)Session["UserDetails"]), out ErrorMessage))
                    {
                        //If delete success then file should be deleted
                        if (isOnlyDelete.Trim().ToUpper() == "Y")
                        {
                            try
                            {
                                if (System.IO.File.Exists(path))
                                {
                                    System.IO.File.Delete(path);
                                }
                            }
                            catch (Exception ex) { ErrorMessage = ErrorMessage + ex.Message; }
                        }

                        return(Json("Ok", JsonRequestBehavior.AllowGet));
                    }
                }
                if (files != null)
                {
                    foreach (HttpPostedFileBase file in files)
                    {
                        objProduct = new ProductOrganiztionImageInfo();

                        if (ImageId.Trim().Replace("0", "").Length == 0)
                        {
                            fileName = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(file.FileName);
                            path     = System.IO.Path.Combine(Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["UploadDataPath"].ToString()), fileName);
                            file.SaveAs(path);
                            objProduct.FileName = fileName;
                            objProduct.FileType = file.ContentType;
                        }


                        objProduct.OrganizationproductId = OrganizationproductId.Trim().Length == 0 ? 0 : Convert.ToInt32(OrganizationproductId.Trim());
                        objProduct.ProductId             = ProductId;
                        objProduct.ImageId  = ImageId.Trim().Length == 0 ? 0 : Convert.ToInt32(ImageId);
                        objProduct.IsActive = IsActive.Trim().ToUpper();
                        objProduct.Ismain   = IsMain.Trim().ToUpper();
                        objProduct.IsActive = IsActive.Trim().ToUpper();

                        if (iGstSvc.Save_ProductOrganizationImage(isOnlyDelete.Trim().ToUpper() == "Y", objProduct, ((UserInfo)Session["UserDetails"]), out ErrorMessage))
                        {
                            //If delete success then file should be deleted
                            if (isOnlyDelete.Trim().ToUpper() == "Y")
                            {
                                try
                                {
                                    if (System.IO.File.Exists(path))
                                    {
                                        System.IO.File.Delete(path);
                                    }
                                }
                                catch (Exception ex) { ErrorMessage = ErrorMessage + ex.Message; }

                                if (ErrorMessage.Trim().Length > 0 && ImageId.Trim().Replace("0", "").Length == 0)
                                {
                                    try
                                    {
                                        if (System.IO.File.Exists(path))
                                        {
                                            System.IO.File.Delete(path);
                                        }
                                    }
                                    catch (Exception ex) { ErrorMessage = ErrorMessage + ex.Message; }
                                }

                                return(Json(ErrorMessage, JsonRequestBehavior.AllowGet));
                            }
                        }
                    }
                }

                return(Json("Ok", JsonRequestBehavior.AllowGet));
            }

            return(Json(ErrorMessage, JsonRequestBehavior.AllowGet));
        }
        public ActionResult GetList_ProductForDropdownlist()
        {
            if (Session["ProductList"] != null && ((List <ProductInfo>)Session["ProductList"]).Count > 0)
            {
                return(Json((List <ProductInfo>)Session["ProductList"], JsonRequestBehavior.AllowGet));
            }
            else
            {
                using (iGst_Svc.GSTServiceClient iGstSvc = new iGst_Svc.GSTServiceClient())
                {
                    if (Session["Language"] == null)
                    {
                        Session["Language"] = 0;
                    }

                    if (Session["UserDetails"] != null && ((UserInfo)Session["UserDetails"]).UserType.ToString().Trim().ToUpper() == "R" && ((UserInfo)Session["UserDetails"]).OrganizationCode != null)
                    {
                        string OrganizationCode = "";
                        OrganizationCode = ((UserInfo)Session["UserDetails"]).OrganizationCode.Trim();

                        List <ProductInfo> list = new Product_Svc.ProductServiceClient().GetList_ProductDropdownlist("", "", false, OrganizationCode, "", false, Session["Language"].ToString());

                        if (list != null && list.Count > 0)
                        {
                            Session["ProductList"] = list;
                            return(Json(list, JsonRequestBehavior.AllowGet));
                        }
                        else
                        {
                            //return Json(new HttpStatusCodeResult(410, "You have to select your products from Product/ service page."), JsonRequestBehavior.AllowGet);
                            return(new HttpStatusCodeResult(410, "You have to select your products from Product/ service page."));
                        }
                    }
                    else if (Session["UserDetails"] != null && ((UserInfo)Session["UserDetails"]).UserType.ToString().Trim().ToUpper() == "M")
                    {
                        List <ProductInfo> list = new Product_Svc.ProductServiceClient().GetList_ProductDropdownlist("", "", false, "", "", false, Session["Language"].ToString());

                        if (list != null && list.Count > 0)
                        {
                            Session["ProductList"] = list;
                            return(Json(list, JsonRequestBehavior.AllowGet));
                        }
                        else
                        {
                            //return Json(new HttpStatusCodeResult(410, "There some problem arrised in product listing."), JsonRequestBehavior.AllowGet);
                            return(new HttpStatusCodeResult(410, "There some problem arrised in product listing."));
                        }
                    }
                    else
                    {
                        List <ProductInfo> list = new Product_Svc.ProductServiceClient().GetList_ProductDropdownlist("", "", false, "", "", false, Session["Language"].ToString());

                        if (list != null && list.Count > 0)
                        {
                            Session["ProductList"] = list;
                            return(Json(list, JsonRequestBehavior.AllowGet));
                        }
                        else
                        {
                            return(Json(new HttpStatusCodeResult(410, "There some problem arrised in product listing."), JsonRequestBehavior.AllowGet));
                        }
                    }
                }
            }
        }