public ActionResult Manage()
        {
            var user = StaticData.GetUser();

            if (user == "")
            {
                Uri action = Request.Url;
                Session["Action"] = action;
                return(RedirectToAction("SignIn", "User"));
            }
            var id   = StaticData.GetIdFromQuery();
            var data = buss.GetList(StaticData.GetUser(), id);

            if (data.Count == 0)
            {
                GroceriesCommon model = new GroceriesCommon();

                model.BreadCum = ApplicationGrid.GetBreadCum("Groceries |Groceries Regestration |Manage ");
                return(View(model));
            }

            foreach (var item in data[0].Doc)
            {
                item.DocName = StaticData.GetDocumentPath() + (item.DocName);
            }
            data[0].BreadCum = ApplicationGrid.GetBreadCum("Groceries |Groceries Regestration |Manage");
            return(View(data[0]));
        }
        public List <GroceriesCommon> GetGridList(GridParam gridParam)
        {
            var list = new List <GroceriesCommon>();

            try
            {
                var sql = "EXEC proc_tblGroceries ";
                sql += " @FLAG = " + dao.FilterString("A");
                sql += ",@User = "******",@Search = " + dao.FilterString(gridParam.Search);
                sql += ",@DisplayLength = " + dao.FilterString(gridParam.DisplayLength.ToString());
                sql += ",@DisplayStart = " + dao.FilterString(gridParam.DisplayStart.ToString());
                sql += ",@SortDir = " + dao.FilterString(gridParam.SortDir);
                sql += ",@SortCol = " + dao.FilterString(gridParam.SortCol.ToString());
                var dt = dao.ExecuteDataTable(sql);

                if (null != dt)
                {
                    int sn = 1;
                    foreach (System.Data.DataRow item in dt.Rows)
                    {
                        var common = new GroceriesCommon()
                        {
                            UniqueId           = Convert.ToInt32(item["RowId"]),
                            ProductReferenceId = item["ProductReferenceId"].ToString(),
                            ProductDestintId   = item["ProductDestintId"].ToString(),
                            Brand           = item["Brand"].ToString(),
                            ProductName     = item["ProductName"].ToString(),
                            ProductPrice    = item["ProductPrice"].ToString(),
                            DiscountPercent = item["DiscountPercent"].ToString(),
                            User            = item["CreatedBy"].ToString(),
                            CreatedDate     = item["CreatedDate"].ToString(),
                            FilterCount     = item["FilterCount"].ToString(),
                        };
                        sn++;
                        list.Add(common);
                    }
                }
                return(list);
            }

            catch (Exception e)
            {
                return(list);
            }
        }
        public List <ProductSearchCommon> ShowGroceries()
        {
            var list          = new List <ProductSearchCommon>();
            var groceriesList = new List <GroceriesCommon>();
            var sql           = "Exec proc_tblGroceries";

            sql += " @Flag = " + dao.FilterString("ShowGroceries");
            var dt = dao.ExecuteDataTable(sql);

            if (null != dt)
            {
                foreach (System.Data.DataRow item in dt.Rows)
                {
                    var table = item["TableName"].ToString();
                    if (table == "tblGroceries")
                    {
                        var Groceries = new GroceriesCommon()
                        {
                            ProductReferenceId = item["ProductReferenceId"].ToString(),
                            ProductDestintId   = item["ProductDestintId"].ToString(),
                            ProductName        = item["ProductName"].ToString(),
                            Brand           = item["Brand"].ToString(),
                            OfferedPrice    = item["OfferedPrice"].ToString(),
                            ProductPrice    = item["ProductPrice"].ToString(),
                            DiscountPercent = item["DiscountPercent"].ToString(),
                            DiscountAmount  = item["DiscountAmount"].ToString(),
                            WarrentyPeriod  = item["WarrentyPeriod"].ToString(),
                            //ProductReviewed=item["ProductReviewed"].ToString(),
                            Doc1 = item["Doc1"].ToString(),
                            Doc2 = item["Doc2"].ToString()
                        };
                        groceriesList.Add(Groceries);
                    }
                }
            }
            if (null != dt)
            {
                var productSearch = new ProductSearchCommon()
                {
                    GroceriesList = groceriesList
                };
                list.Add(productSearch);
            }
            return(list);
        }
        public DbResponse Manage(GroceriesCommon model)
        {
            try
            {
                var sql = "EXEC proc_tblGroceries ";
                sql += " @flag = " + dao.FilterString((model.UniqueId > 0 ? "U" : "I"));
                sql += ",@User = "******",@RowId = " + dao.FilterString(model.UniqueId.ToString());
                sql += ",@ProductReferenceId = " + dao.FilterString(model.ProductReferenceId == null ? "" : model.ProductReferenceId.ToString());
                sql += ",@ProductDestintId=" + dao.FilterString(model.ProductDestintId == null ? "" : model.ProductDestintId.ToString());
                sql += ",@Brand=" + dao.FilterString(model.Brand == null ? "" : model.Brand.ToString());
                sql += ",@ProductName=" + dao.FilterString(model.ProductName == null ? "" : model.ProductName.ToString());
                sql += ",@ProductUnit=" + dao.FilterString(model.ProductUnit == null ? "" : model.ProductUnit.ToString());
                sql += ",@QuntityUnit=" + dao.FilterString(model.QuntityUnit == null ? "" : model.QuntityUnit.ToString());
                sql += ",@ProductVolume=" + dao.FilterString(model.ProductVolume == null ? "" : model.ProductVolume.ToString());
                sql += ",@QuantityPerVolume=" + dao.FilterString(model.QuantityPerVolume == null ? "" : model.QuantityPerVolume.ToString());

                sql += ",@OfferedPrice=" + dao.FilterString(model.OfferedPrice == null ? "" : model.OfferedPrice.ToString());
                sql += ",@DiscountPercent=" + dao.FilterString(model.DiscountPercent == null ? "" : model.DiscountPercent.ToString());
                sql += ",@DiscountAmount=" + dao.FilterString(model.DiscountAmount == null ? "" : model.DiscountAmount.ToString());
                sql += ",@ProductPrice=" + dao.FilterString(model.ProductPrice == null ? "" : model.ProductPrice.ToString());
                sql += ",@QuickLinksSEOTag=" + dao.FilterString(model.QuickLinksSEOTag == null ? "" : model.QuickLinksSEOTag.ToString());
                sql += ",@Warrenty=" + dao.FilterString(model.Warrenty == null ? "" : model.Warrenty.ToString());
                sql += ",@WarrentyPeriod=" + dao.FilterString(model.WarrentyPeriod == null ? "" : model.WarrentyPeriod.ToString());
                sql += ",@WarrentyCondition=" + dao.FilterString(model.WarrentyCondition == null ? "" : model.WarrentyCondition.ToString());
                sql += ",@ProductDescription=" + dao.FilterString(model.ProductDescription == null ? "" : model.ProductDescription.ToString());
                sql += ",@TermsAndConditions=" + dao.FilterString(model.TermsAndConditions == null ? "" : model.TermsAndConditions.ToString());
                sql += ",@Highlights=" + dao.FilterString(model.Highlights == null ? "" : model.Highlights.ToString());
                sql += ",@Specification=" + dao.FilterString(model.Specification == null ? "" : model.Specification.ToString());


                return(dao.ParseDbResponse(sql));
            }
            catch (Exception ex)
            {
                return(dao.ExceptionDbResponse(ex.Message));
            }
        }
        public ActionResult Manage(GroceriesCommon model)
        {
            if (model != null)
            {
                model.User = StaticData.GetUser();

                var response = buss.Manage(model);
                var imgref   = response.Id.Split(';');
                model.ProductReferenceId = imgref[0];
                model.ProductDestintId   = imgref[1];

                StaticData.SetMessageInSession(response);
                if (response.ErrorCode == 1)
                {
                    ModelState.AddModelError("", response.Message);
                    model.BreadCum = ApplicationGrid.GetBreadCum("Groceries |Groceries Regestration |Manage ");

                    return(View(model));
                }
                else if (model.Doc != null)
                {
                    foreach (var item in model.Doc)
                    {
                        if (item.Img != null)
                        {
                            var uploaded = UploadDoc(model.ProductReferenceId, model.ProductDestintId, item.View, item.Color, item.Img, "");
                            if (uploaded.ErrorCode == 1)
                            {
                                StaticData.SetMessageInSession(0, "Data Saved but " + uploaded.Message);
                            }
                        }
                    }
                }
            }

            return(RedirectToAction("Index"));
        }
 public DbResponse Manage(GroceriesCommon model)
 {
     return(repo.Manage(model));
 }
        public List <GroceriesCommon> GetList(string user, string id)
        {
            var list = new List <GroceriesCommon>();

            try
            {
                var sql = "EXEC proc_tblGroceries ";
                sql += " @FLAG = " + dao.FilterString((id != "0" ? "S" : "A"));
                sql += ",@User = "******",@RowId = " + dao.FilterString(id.ToString());

                var ds = dao.ExecuteDataset(sql);

                if (null != ds.Tables[0])
                {
                    int sn = 1;
                    foreach (System.Data.DataRow item in ds.Tables[0].Rows)
                    {
                        var common = new GroceriesCommon()
                        {
                            UniqueId           = Convert.ToInt32(item["RowId"]),
                            ProductReferenceId = item["ProductReferenceId"].ToString(),
                            ProductDestintId   = item["ProductDestintId"].ToString(),
                            Brand             = item["Brand"].ToString(),
                            ProductName       = item["ProductName"].ToString(),
                            ProductUnit       = item["ProductUnit"].ToString(),
                            QuntityUnit       = item["QuntityUnit"].ToString(),
                            ProductVolume     = item["ProductVolume"].ToString(),
                            QuantityPerVolume = item["QuantityPerVolume"].ToString(),

                            ProductDescription = item["ProductDescription"].ToString(),
                            SupplierEmail      = item["SupplierEmail"].ToString(),
                            SupplierAddress    = item["SupplierAddress"].ToString(),
                            SupplierContactNo  = item["SupplierContactNo"].ToString(),
                            ProductPrice       = item["ProductPrice"].ToString(),
                            OfferedPrice       = item["OfferedPrice"].ToString(),
                            DiscountPercent    = item["DiscountPercent"].ToString(),
                            DiscountAmount     = item["DiscountAmount"].ToString(),
                            Warrenty           = item["Warrenty"].ToString(),
                            WarrentyCondition  = item["WarrentyCondition"].ToString(),
                            WarrentyPeriod     = item["WarrentyPeriod"].ToString(),
                            Highlights         = item["Highlights"].ToString(),
                            Specification      = item["Specification"].ToString(),
                            TermsAndConditions = item["TermsAndConditions"].ToString(),
                            QuickLinksSEOTag   = item["QuickLinksSEOTag"].ToString(),
                            ProductReviewed    = item["ProductReviewed"].ToString(),
                            User        = item["CreatedBy"].ToString(),
                            CreatedDate = item["CreatedDate"].ToString(),
                        };


                        var DocList = new List <DocumentUpload>();
                        if (ds.Tables.Count > 1)
                        {
                            if (null != ds.Tables[1])
                            {
                                foreach (System.Data.DataRow item1 in ds.Tables[1].Rows)
                                {
                                    var Doc = new DocumentUpload()
                                    {
                                        View    = item1["Viewof"].ToString(),
                                        Color   = item1["Color"].ToString(),
                                        DocName = item1["DocName"].ToString(),
                                    };
                                    DocList.Add(Doc);
                                }
                            }
                        }
                        common.Doc = DocList;



                        sn++;
                        list.Add(common);
                    }
                }
            }
            catch (Exception e)
            {
                return(list);
            }

            return(list);
        }