Esempio n. 1
0
        public static ItemCategoryModel ToItemCategoryModel(Item item)
        {
            var itemModel = new ItemCategoryModel {
                Id               = item.Id,
                Name             = item.Name,
                ShortDescription = item.ShortDescription,
                Price            = item.Price,
                ImageUrl         = null,
                InStock          = item.InStock,
                Categories       = null
            };

            if (item.Categories != null)
            {
                itemModel.Categories = new List <CategoryMenuItemModel>(
                    item.Categories.Select(ToCategoryMenuItemModel));
            }

            if (item.Image != null)
            {
                itemModel.ImageUrl = ToBase64String(item.Image);
            }

            return(itemModel);
        }
        // GET: ItemCategory/Edit/5
        public ActionResult Edit(int id)
        {
            ItemCategoryRepository repository = new ItemCategoryRepository();

            ItemCategoryModel model = repository.GetById(id);

            return(View(model));
        }
        public IItemCategoryModel MakeItemCategory(int CategoryNum, string Description)
        {
            IItemCategoryModel itemCategory = new ItemCategoryModel();

            itemCategory.CategoryNum         = CategoryNum;
            itemCategory.CategoryDescription = Description;

            return(itemCategory);
        }
Esempio n. 4
0
        public async Task <IActionResult> Put([FromBody] ItemCategoryModel value)
        {
            var itemcategory = mapper.Map <ItemCategory>(value);
            var res          = await datamanager.Update(itemcategory);

            if (res == null)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
            return(Ok(mapper.Map <ItemCategoryModel>(res)));
        }
 public async Task <JsonResult> ItemCategoryCreate([FromBody] ItemCategoryModel icm)
 {
     try
     {
         return(await _itemLogic.ItemCategoryCreate(icm).ConfigureAwait(false));
     }
     catch (Exception ee)
     {
         return(await _itemLogic.SendRespose("False", ee.Message).ConfigureAwait(false));
     }
 }
        public ActionResult Edit(int id, ItemCategoryModel ModelObject)
        {
            try
            {
                ItemCategoryRepository repository = new ItemCategoryRepository();
                repository.Update(ModelObject);

                return(RedirectToAction("GetAll"));
            }
            catch
            {
                return(View());
            }
        }
        public bool Add(ItemCategoryModel obj)
        {
            using (SqlConnection db = SQLConnector.Connect())
            {
                db.Open();

                SqlCommand com = new SqlCommand("AddItemCategory", db);
                com.CommandType = CommandType.StoredProcedure;
                com.Parameters.AddWithValue("@Category", obj.Category);

                if (com.ExecuteNonQuery() == -1)
                {
                    return(false);
                }
                return(true);
            }
        }
        public ActionResult Create(ItemCategoryModel ModelObject)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    ItemCategoryRepository repository = new ItemCategoryRepository();
                    repository.Add(ModelObject);
                    return(RedirectToAction("GetAll"));
                }

                return(View());
            }
            catch
            {
                return(View());
            }
        }
        public ItemCategoryModel GetById(int id)
        {
            using (SqlConnection db = SQLConnector.Connect())
            {
                db.Open();

                ItemCategoryModel ModelObject = new ItemCategoryModel();

                SqlCommand com = new SqlCommand("GetItemCategoryById", db);
                com.CommandType = CommandType.StoredProcedure;
                com.Parameters.AddWithValue("@Id", id);
                com.ExecuteNonQuery();
                SqlDataAdapter da = new SqlDataAdapter(com);
                DataTable      dt = new DataTable();
                da.Fill(dt);

                return(FillTable(dt)[0]);
            }
        }
Esempio n. 10
0
        public async Task <IHttpActionResult> Post(ItemCategoryModel ic)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var mapped = _mapper.Map <ItemCategory>(ic);
                    _repo.AddItemCategory(mapped);

                    if (await _repo.SaveChangesAsync())
                    {
                        return(Created("GetItemCategories", mapped.ItemCategoryId));
                    }
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
            return(BadRequest());
        }
Esempio n. 11
0
        internal async Task <JsonResult> ItemCategoryCreate(ItemCategoryModel icm)
        {
            SqlConnection cn = null;

            try
            {
                cn = Connection.GetConnection();
                SqlCommand smd = new SqlCommand("[item_category_create]", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };
                smd.Parameters.AddWithValue("@code", icm.code);
                smd.Parameters.AddWithValue("@name", icm.name);
                smd.Parameters.AddWithValue("@sub_id", icm.SubId);
                smd.Parameters.AddWithValue("@description", icm.description);
                smd.Parameters.AddWithValue("@flag", icm.flag);
                smd.Parameters.AddWithValue("@created_by", icm.created_by);
                smd.Parameters.AddWithValue("@update_by", icm.updated_by);
                smd.Parameters.Add("@jsonOutput", SqlDbType.NVarChar, -1).Direction = ParameterDirection.Output;

                // Execute the command
                await smd.ExecuteNonQueryAsync().ConfigureAwait(false);

                // Get the values
                string json = smd.Parameters["@jsonOutput"].Value.ToString();
                smd.Dispose();

                JArray arr = JArray.Parse(json);

                return(new JsonResult(arr));
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                Connection.CloseConnection(ref cn);
            }
        }
Esempio n. 12
0
        public async Task <IActionResult> Post([FromBody] ItemCategoryModel value)
        {
            var itemcategory = mapper.Map <ItemCategory>(value);

            if (!string.IsNullOrEmpty(value.Id))
            {
                var existing = await datamanager.Get(value.Id);

                var mapped = mapper.Map <ItemCategoryModel>(existing);
                if (mapped == value)
                {
                    return(NoContent());
                }
            }
            var res = await datamanager.Insert(itemcategory);

            if (res == null)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
            return(Ok(mapper.Map <ItemCategoryModel>(res)));
        }
        public JsonResult CreateItemCategory(ItemCategoryModel model)
        {
            if (!ModelState.IsValid)
            {
                return(Json(new
                {
                    Result = "ERROR",
                    Message = "Form is not valid! " +
                              "Please correct it and try again."
                }));
            }

            if (!User.IsInRole("Officer"))
            {
                return(Json(new
                {
                    Result = "ERROR",
                    Message = "You do not have the authority to create a new item category."
                }));
            }

            try
            {
                JourListDMContainer dm = new JourListDMContainer();

                ItemCategory item = new ItemCategory();
                item.Description = model.Description;
                dm.AddToItemCategories(item);
                dm.SaveChanges();

                model.Id = item.Id;

                return(Json(new { Result = "OK", Record = model }));
            }
            catch (Exception e)
            {
                return(Json(new { Result = "ERROR", Message = e.Message }));
            }
        }
Esempio n. 14
0
        public ActionResult ViewCategory(int?id)
        {
            if (Request.HttpMethod.ToLower() == "post")
            {
                return(SaveCategory());
            }
            ItemCategoryModel cat = null;

            if (id != null)
            {
                cat = context.ItemCategories.Where(c => c.CategoryId == id).Select(c => new ItemCategoryModel
                {
                    CategoryId  = c.CategoryId,
                    Description = c.Description
                }).FirstOrDefault();
                cat.NumberOfProducts = context.Items.Where(c => c.CategoryId == id).Count();
            }
            if (cat == null)
            {
                cat = new ItemCategoryModel();
            }
            return(View(cat));
        }
        ////
        //// POST: /DataManagement/GetUnitTypeOptions
        //[HttpPost]
        //public JsonResult GetUnitTypeOptions()
        //{
        //    try
        //    {
        //        JourListDMContainer dm = new JourListDMContainer();
        //        var list = dm.UnitTypes.Select(z => new { DisplayText = z.Description, Value = z.Id });
        //        return Json(new { Result = "OK", Options = list });
        //    }
        //    catch (Exception e)
        //    {
        //        return Json(new { Result = "ERROR", Message = e.Message });
        //    }
        //}

        #endregion

        #region ItemCategory

        // POST: /DataManagement/ItemCategoryList
        public JsonResult ItemCategoryList()
        {
            try
            {
                JourListDMContainer      dm   = new JourListDMContainer();
                List <ItemCategoryModel> list = new List <ItemCategoryModel>();

                foreach (var a in dm.ItemCategories.Where(z => z.Active == true))
                {
                    ItemCategoryModel item = new ItemCategoryModel();
                    item.Id          = a.Id;
                    item.Description = a.Description;
                    item.Active      = a.Active;
                    list.Add(item);
                }

                return(Json(new { Result = "OK", Records = list }));
            }
            catch (Exception e)
            {
                return(Json(new { Result = "ERROR", Message = e.Message }));
            }
        }
        public JsonResult UpdateItemCategory(ItemCategoryModel model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(Json(new
                    {
                        Result = "ERROR",
                        Message = "Form is not valid! " +
                                  "Please correct it and try again."
                    }));
                }

                if (!User.IsInRole("Officer"))
                {
                    return(Json(new
                    {
                        Result = "ERROR",
                        Message = "You do not have the authority to update this item category."
                    }));
                }

                JourListDMContainer dm = new JourListDMContainer();

                ItemCategory item = dm.ItemCategories.Single(z => z.Id == model.Id);
                item.Description = model.Description;
                item.Active      = model.Active;
                dm.SaveChanges();

                return(Json(new { Result = "OK" }));
            }
            catch (Exception e)
            {
                return(Json(new { Result = "ERROR", Message = e.Message }));
            }
        }
        public static Hashtable TaxDetails(Hashtable ht, string Type, string Req)
        {
            try
            {
                string[] words = null;
                string   Data  = Req;

                ReturnData.Clear();

                if (Type == "Fill")
                {
                    words = null;
                    words = Req.Split('@');
                    for (int m = 0; words.Count() > m; m++)
                    {
                        Data = words[m].ToString();

                        if (Data == "PaySchedule")
                        {
                            _ItemCategoryModel.Clear();
                            ht_param.Clear();
                            ht_param.Add("@Company_ID", HttpContext.Current.Session["Company_ID"].ToString());
                            ht_param.Add("@Branch_ID", HttpContext.Current.Session["Branch_ID"].ToString());
                            ht_param.Add("@login_id", HttpContext.Current.Session["Login_user_ID"].ToString());
                            ds = db.SysFetchDataInDataSet("[get_PaySchedule]", ht_param);

                            if (ds.Tables.Count > 0)
                            {
                                foreach (DataRow item in ds.Tables[0].Rows)
                                {
                                    ItemCategoryModel ItemCategoryModel_Detail = new ItemCategoryModel();
                                    ItemCategoryModel_Detail.NAME = item["PaySchedule"].ToString();
                                    ItemCategoryModel_Detail.ID   = item["id"].ToString();
                                    _ItemCategoryModel.Add(ItemCategoryModel_Detail);
                                }
                            }
                            ReturnData["PaySchedule"] = serializer.Serialize(_ItemCategoryModel);
                        }
                        if (Data == "TicketQueryMaster")
                        {
                            _ItemCategoryModel.Clear();
                            ht_param.Clear();
                            ht_param.Add("@Company_ID", HttpContext.Current.Session["Company_ID"].ToString());
                            ht_param.Add("@Branch_ID", HttpContext.Current.Session["Branch_ID"].ToString());
                            ht_param.Add("@login_id", HttpContext.Current.Session["Login_user_ID"].ToString());
                            ds = db.SysFetchDataInDataSet("[get_TicketQueryMaster]", ht_param);

                            if (ds.Tables.Count > 0)
                            {
                                foreach (DataRow item in ds.Tables[0].Rows)
                                {
                                    ItemCategoryModel ItemCategoryModel_Detail = new ItemCategoryModel();
                                    ItemCategoryModel_Detail.NAME = item["name"].ToString();
                                    ItemCategoryModel_Detail.ID   = item["id"].ToString();
                                    _ItemCategoryModel.Add(ItemCategoryModel_Detail);
                                }
                            }
                            ReturnData["TicketQueryMaster"] = serializer.Serialize(_ItemCategoryModel);
                        }
                        if (Data == "TicketQueryReasonMaster")
                        {
                            _TicketQueryReasonMasterModel.Clear();
                            ht_param.Clear();
                            ht_param.Add("@Company_ID", HttpContext.Current.Session["Company_ID"].ToString());
                            ht_param.Add("@Branch_ID", HttpContext.Current.Session["Branch_ID"].ToString());
                            ht_param.Add("@login_id", HttpContext.Current.Session["Login_user_ID"].ToString());
                            ht_param.Add("@TicketQueryMasterId", ht["TicketQueryMasterId"].ToString());
                            ds = db.SysFetchDataInDataSet("[get_TicketQueryReasonMaster]", ht_param);

                            if (ds.Tables.Count > 0)
                            {
                                foreach (DataRow item in ds.Tables[0].Rows)
                                {
                                    TicketQueryReasonMasterModel TicketQueryReasonMasterModel_Detail = new TicketQueryReasonMasterModel();
                                    TicketQueryReasonMasterModel_Detail.id              = item["id"].ToString();
                                    TicketQueryReasonMasterModel_Detail.name            = item["name"].ToString();
                                    TicketQueryReasonMasterModel_Detail.PayScheduleNo   = item["PayScheduleNo"].ToString();
                                    TicketQueryReasonMasterModel_Detail.CreditedAmount  = item["CreditedAmount"].ToString();
                                    TicketQueryReasonMasterModel_Detail.EstimatedAmount = item["EstimatedAmount"].ToString();
                                    TicketQueryReasonMasterModel_Detail.Comments        = item["Comments"].ToString();
                                    TicketQueryReasonMasterModel_Detail.orderid         = item["orderid"].ToString();
                                    TicketQueryReasonMasterModel_Detail.Attatchments    = item["Attatchments"].ToString();
                                    TicketQueryReasonMasterModel_Detail.subject         = item["subject"].ToString();
                                    _TicketQueryReasonMasterModel.Add(TicketQueryReasonMasterModel_Detail);
                                }
                            }
                            ReturnData["TicketQueryReasonMaster"] = serializer.Serialize(_TicketQueryReasonMasterModel);
                        }
                    }
                }

                if (Type == "Save")
                {
                    _UserSaveModel.Clear();

                    ht_param.Clear();
                    ht_param.Add("@TicketQueryMasterId", ht["TicketQueryMasterId"].ToString());
                    ht_param.Add("@TicketQueryReasonMasterId", ht["TicketQueryReasonMasterId"].ToString());
                    ht_param.Add("@Contact_id", HttpContext.Current.Session["Login_user_ID"].ToString());
                    ht_param.Add("@PayScheduleNo", ht["PayScheduleNo"].ToString());
                    ht_param.Add("@CreditedAmount", ht["CreditedAmount"].ToString());
                    ht_param.Add("@EstimatedAmount", ht["EstimatedAmount"].ToString());
                    ht_param.Add("@ORDER_NUMBER", ht["ORDER_NUMBER"].ToString());
                    ht_param.Add("@Attatchments", ht["Attatchments"].ToString());
                    ht_param.Add("@Subject", ht["Subject"].ToString());
                    ht_param.Add("@Comments", ht["Comments"].ToString());
                    ht_param.Add("@Company_ID", HttpContext.Current.Session["Company_ID"].ToString());
                    ht_param.Add("@Branch_ID", HttpContext.Current.Session["Branch_ID"].ToString());
                    ht_param.Add("@login_id", HttpContext.Current.Session["Login_user_ID"].ToString());
                    ds = db.SysFetchDataInDataSet("[TicketQuery_Insert]", ht_param);
                    if (ds.Tables.Count > 0)
                    {
                        foreach (DataRow item in ds.Tables[0].Rows)
                        {
                            UserSaveModel _UserSaveModelDetails = new UserSaveModel();
                            _UserSaveModelDetails.CustomErrorState = item["CustomErrorState"].ToString();
                            _UserSaveModelDetails.CustomMessage    = item["CustomMessage"].ToString();
                            _UserSaveModel.Add(_UserSaveModelDetails);
                        }
                    }
                    ReturnData["Save"] = serializer.Serialize(_UserSaveModel);
                }


                _ErrorModel.Clear();
                ErrorModel _error = new ErrorModel();
                _error.Error        = "false";
                _error.ErrorMessage = "sucess";
                _ErrorModel.Add(_error);
                ReturnData["ErrorDetail"] = serializer.Serialize(_ErrorModel);
                HttpContext.Current.Response.AppendHeader("ResponseHeader", "200");
            }
            catch (Exception ex)
            {
                _ErrorModel.Clear();
                ReturnData.Clear();
                ErrorModel _error = new ErrorModel();
                _error.Error        = "true";
                _error.ErrorMessage = "Some problem occurred please try again later";
                _ErrorModel.Add(_error);
                ReturnData["ErrorDetail"] = serializer.Serialize(_ErrorModel);
                HttpContext.Current.Response.AppendHeader("ResponseHeader", "500");
            }
            return(ReturnData);
        }
Esempio n. 18
0
 public static ItemCategory ToEntity(this ItemCategoryModel model)
 {
     return(model.MapTo <ItemCategoryModel, ItemCategory>());
 }
Esempio n. 19
0
 public static ItemCategory ToEntity(this ItemCategoryModel model, ItemCategory destination)
 {
     return(model.MapTo(destination));
 }
        public async Task <IActionResult> AddOrEdit(int id, [Bind("Nbr,ItemCateg,ItemCategName,ItemCategType,AddDate,UpdDate,UserName,ComputerName")] int?page, ItemCategoryModel itemCategoryModel)
        {
            if (!ModelState.IsValid)
            {
                return(Json(new
                            { isValid = false, html = Helper.RenderRazorViewToString(this, "AddOrEdit", itemCategoryModel) }));
            }
            //Insert
            if (id == 0)
            {
                itemCategoryModel.AddDate = DateTime.Now;
                //itemCategoryModel.UpdDate = null;
                itemCategoryModel.ComputerName = Request.HttpContext.Connection.RemoteIpAddress.ToString();
                itemCategoryModel.UserName     = User.Identity.Name;
                _context.Add(itemCategoryModel);
                await _context.SaveChangesAsync();
            }
            //Update
            else
            {
                try
                {
                    ViewBag.pageCurrent = page;

                    //update spec field EF
                    _context.ItemCategory.Attach(itemCategoryModel);

                    itemCategoryModel.UpdDate       = DateTime.Now;
                    itemCategoryModel.ItemCategName = itemCategoryModel.ItemCategName;
                    itemCategoryModel.ItemCategType = itemCategoryModel.ItemCategType;
                    itemCategoryModel.UserName      = User.Identity.Name;
                    itemCategoryModel.ComputerName  = Request.HttpContext.Connection.RemoteIpAddress.ToString();
                    _context.Entry(itemCategoryModel).Property(x => x.UpdDate).IsModified       = true;
                    _context.Entry(itemCategoryModel).Property(x => x.ItemCategName).IsModified = true;
                    _context.Entry(itemCategoryModel).Property(x => x.ItemCategType).IsModified = true;
                    _context.Entry(itemCategoryModel).Property(x => x.UserName).IsModified      = true;
                    _context.Entry(itemCategoryModel).Property(x => x.ComputerName).IsModified  = true;



                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ItemCategoryModelExists(itemCategoryModel.Nbr))
                    {
                        return(NotFound());
                    }

                    throw;
                }
            }
            const int pageSize = 8;

            return(Json(new { isValid = true, html = Helper.RenderRazorViewToString(this, "_ViewAll", await _context.ItemCategory.ToPagedListAsync(page ?? 1, pageSize)) }));
        }
Esempio n. 21
0
        public static Hashtable TaxDetails(Hashtable ht, string Type, string Req)
        {
            try
            {
                string[] words = null;
                string   Data  = Req;

                ReturnData.Clear();

                if (Type == "Fill")
                {
                    words = null;
                    words = Req.Split('@');
                    for (int m = 0; words.Count() > m; m++)
                    {
                        Data = words[m].ToString();

                        if (Data == "CATEGORY")
                        {
                            _ItemCategoryModel.Clear();
                            ht_param.Clear();
                            ht_param.Add("@Company_ID", HttpContext.Current.Session["Company_ID"].ToString());
                            ht_param.Add("@Branch_ID", HttpContext.Current.Session["Branch_ID"].ToString());
                            ht_param.Add("@login_id", HttpContext.Current.Session["Login_user_ID"].ToString());
                            ds = db.SysFetchDataInDataSet("[GET_ITEM_CATEGORY]", ht_param);

                            if (ds.Tables.Count > 0)
                            {
                                foreach (DataRow item in ds.Tables[0].Rows)
                                {
                                    ItemCategoryModel ItemCategoryModel_Detail = new ItemCategoryModel();
                                    ItemCategoryModel_Detail.NAME = item["NAME"].ToString();
                                    ItemCategoryModel_Detail.ID   = item["ID"].ToString();
                                    _ItemCategoryModel.Add(ItemCategoryModel_Detail);
                                }
                            }
                            ReturnData["CATEGORY"] = serializer.Serialize(_ItemCategoryModel);
                        }
                        if (Data == "GST")
                        {
                            _gstModel.Clear();
                            ht_param.Clear();
                            ht_param.Add("@Company_ID", HttpContext.Current.Session["Company_ID"].ToString());
                            ht_param.Add("@Branch_ID", HttpContext.Current.Session["Branch_ID"].ToString());
                            ht_param.Add("@login_id", HttpContext.Current.Session["Login_user_ID"].ToString());
                            ds = db.SysFetchDataInDataSet("[GET_GST]", ht_param);

                            if (ds.Tables.Count > 0)
                            {
                                foreach (DataRow item in ds.Tables[0].Rows)
                                {
                                    gstModel gstModel_Detail = new gstModel();
                                    gstModel_Detail.ID   = item["ID"].ToString();
                                    gstModel_Detail.IGST = item["IGST_PERCENTAGE"].ToString();
                                    _gstModel.Add(gstModel_Detail);
                                }
                            }
                            ReturnData["GST"] = serializer.Serialize(_gstModel);
                        }


                        if (Data == "Edit")
                        {
                            ht_param.Clear();
                            ht_param.Add("@ID", ht["ID"].ToString());
                            ht_param.Add("@Company_ID", HttpContext.Current.Session["Company_ID"].ToString());
                            ht_param.Add("@Branch_ID", HttpContext.Current.Session["Branch_ID"].ToString());
                            ht_param.Add("@login_id", HttpContext.Current.Session["Login_user_ID"].ToString());
                            ds = db.SysFetchDataInDataSet("[GET_ITEM_DETAILS]", ht_param);

                            if (ds.Tables.Count > 0)
                            {
                                _ItemDetailsModel = ds.Tables[0].AsEnumerable()
                                                    .Select(row => new ItemDetailsModel
                                {
                                    ID                  = row["ID"].ToString(),
                                    CATEGORY_ID         = row["CATEGORY_ID"].ToString(),
                                    NAME                = row["NAME"].ToString(),
                                    PBO_PRICE           = row["PBO_PRICE"].ToString(),
                                    PRODUCT_SVP         = row["PRODUCT_SVP"].ToString(),
                                    DISCOUNT_PERCENTAGE = row["DISCOUNT_PERCENTAGE"].ToString(),
                                    DISCOUNT_AMOUNT     = row["DISCOUNT_AMOUNT"].ToString(),
                                    CODE                = row["CODE"].ToString(),
                                    GST_ID              = row["GST_ID"].ToString(),
                                    MRP                 = row["MRP"].ToString(),
                                    SALE_PRICE          = row["SALE_PRICE"].ToString(),
                                    ImageURL            = row["ImageURL"].ToString(),
                                    IsActive            = row["IsActive"].ToString(),
                                    CATEGORY_NAME       = row["CATEGORY_NAME"].ToString(),
                                    IGST_PERCENTAGE     = row["IGST_PERCENTAGE"].ToString(),
                                    CGST_PERCENTAGE     = row["CGST_PERCENTAGE"].ToString(),
                                    SGST_PERCENTAGE     = row["SGST_PERCENTAGE"].ToString()
                                }).ToList();
                            }

                            ReturnData["TaxData"] = serializer.Serialize(_ItemDetailsModel);
                        }
                    }
                }

                if (Type == "Save")
                {
                    _UserSaveModel.Clear();

                    ht_param.Clear();
                    ht_param.Add("@CATEGORY_ID", ht["CATEGORY_ID"].ToString());
                    ht_param.Add("@NAME", ht["NAME"].ToString());
                    ht_param.Add("@PBO_PRICE", ht["PBO_PRICE"].ToString());
                    ht_param.Add("@PRODUCT_SVP", ht["PRODUCT_SVP"].ToString());
                    ht_param.Add("@DISCOUNT_PERCENTAGE", ht["DISCOUNT_PERCENTAGE"].ToString());
                    ht_param.Add("@DISCOUNT_AMOUNT", ht["DISCOUNT_AMOUNT"].ToString());
                    ht_param.Add("@CODE", ht["CODE"].ToString());
                    ht_param.Add("@GST_ID", ht["GST_ID"].ToString());
                    ht_param.Add("@MRP", ht["MRP"].ToString());
                    ht_param.Add("@SALE_PRICE", ht["SALE_PRICE"].ToString());
                    ht_param.Add("@IsActive", ht["IsActive"].ToString());
                    ht_param.Add("@Company_ID", HttpContext.Current.Session["Company_ID"].ToString());
                    ht_param.Add("@Branch_ID", HttpContext.Current.Session["Branch_ID"].ToString());
                    ht_param.Add("@login_id", HttpContext.Current.Session["Login_user_ID"].ToString());
                    ds = db.SysFetchDataInDataSet("[SAVE_UPDATE_ITEM_DETAILS]", ht_param);
                    if (ds.Tables.Count > 0)
                    {
                        foreach (DataRow item in ds.Tables[0].Rows)
                        {
                            UserSaveModel _UserSaveModelDetails = new UserSaveModel();
                            _UserSaveModelDetails.CustomErrorState = item["CustomErrorState"].ToString();
                            _UserSaveModelDetails.CustomMessage    = item["CustomMessage"].ToString();
                            _UserSaveModel.Add(_UserSaveModelDetails);
                        }
                    }
                    ReturnData["Save"] = serializer.Serialize(_UserSaveModel);
                }


                if (Type == "Update")
                {
                    _UserSaveModel.Clear();

                    ht_param.Clear();
                    ht_param.Add("@ID", ht["ID"]);
                    ht_param.Add("@CATEGORY_ID", ht["CATEGORY_ID"].ToString());
                    ht_param.Add("@NAME", ht["NAME"].ToString());
                    ht_param.Add("@PBO_PRICE", ht["PBO_PRICE"].ToString());
                    ht_param.Add("@PRODUCT_SVP", ht["PRODUCT_SVP"].ToString());
                    ht_param.Add("@DISCOUNT_PERCENTAGE", ht["DISCOUNT_PERCENTAGE"].ToString());
                    ht_param.Add("@DISCOUNT_AMOUNT", ht["DISCOUNT_AMOUNT"].ToString());
                    ht_param.Add("@CODE", ht["CODE"].ToString());
                    ht_param.Add("@GST_ID", ht["GST_ID"].ToString());
                    ht_param.Add("@MRP", ht["MRP"].ToString());
                    ht_param.Add("@SALE_PRICE", ht["SALE_PRICE"].ToString());
                    ht_param.Add("@IsActive", ht["IsActive"].ToString());
                    ht_param.Add("@Company_ID", HttpContext.Current.Session["Company_ID"].ToString());
                    ht_param.Add("@Branch_ID", HttpContext.Current.Session["Branch_ID"].ToString());
                    ht_param.Add("@login_id", HttpContext.Current.Session["Login_user_ID"].ToString());
                    ds = db.SysFetchDataInDataSet("[SAVE_UPDATE_ITEM_DETAILS]", ht_param);
                    if (ds.Tables.Count > 0)
                    {
                        foreach (DataRow item in ds.Tables[0].Rows)
                        {
                            UserSaveModel _UserSaveModelDetails = new UserSaveModel();
                            _UserSaveModelDetails.CustomErrorState = item["CustomErrorState"].ToString();
                            _UserSaveModelDetails.CustomMessage    = item["CustomMessage"].ToString();
                            _UserSaveModel.Add(_UserSaveModelDetails);
                        }
                    }
                    ReturnData["Update"] = serializer.Serialize(_UserSaveModel);
                }



                _ErrorModel.Clear();
                ErrorModel _error = new ErrorModel();
                _error.Error        = "false";
                _error.ErrorMessage = "sucess";
                _ErrorModel.Add(_error);
                ReturnData["ErrorDetail"] = serializer.Serialize(_ErrorModel);
                HttpContext.Current.Response.AppendHeader("ResponseHeader", "200");
            }
            catch (Exception ex)
            {
                _ErrorModel.Clear();
                ReturnData.Clear();
                ErrorModel _error = new ErrorModel();
                _error.Error        = "true";
                _error.ErrorMessage = "Some problem occurred please try again later";
                _ErrorModel.Add(_error);
                ReturnData["ErrorDetail"] = serializer.Serialize(_ErrorModel);
                HttpContext.Current.Response.AppendHeader("ResponseHeader", "500");
            }
            return(ReturnData);
        }