Esempio n. 1
0
        public ActionResult DeleteItemGroup(int GroupId)
        {
            ItemGroupDal itemGroupDal = new ItemGroupDal();
            int          i            = itemGroupDal.DeleteItemGroup(GroupId);

            return(Json(i, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public ActionResult GetAllItemGroup()
        {
            ItemGroupDal        itemGroupDal    = new ItemGroupDal();
            List <ItemGroupDto> lstItemGroupDto = itemGroupDal.GetAndEditItemGroup(0, 1);

            return(Json(lstItemGroupDto, JsonRequestBehavior.AllowGet));
        }
Esempio n. 3
0
        public ActionResult SaveItemGroup()
        {
            try
            {
                ItemGroupDal itemGroupDal = new ItemGroupDal();
                ItemGroupDto itemGroupDto = new ItemGroupDto();
                itemGroupDto.GroupId = Convert.ToInt32(System.Web.HttpContext.Current.Request["GroupId"] == "" ? "0" : System.Web.HttpContext.Current.Request["GroupId"]);
                string Message, fileName, actualFileName;
                Message = fileName = actualFileName = string.Empty;
                if (Request.Files.Count > 0)
                {
                    var fileContent = Request.Files[0];
                    if (fileContent != null && fileContent.ContentLength > 0)
                    {
                        actualFileName          = fileContent.FileName;
                        fileName                = Guid.NewGuid() + Path.GetExtension(fileContent.FileName);
                        itemGroupDto.GroupImage = fileName;
                    }
                    fileContent.SaveAs(Path.Combine(Server.MapPath("~/UploadImages/"), fileName));
                }
                else
                {
                    fileName = "";
                    if (itemGroupDto.GroupId > 0)
                    {
                        dynamic imgFile = itemGroupDal.GetAndEditItemGroup(itemGroupDto.GroupId, 1);
                        itemGroupDto.GroupImage = Convert.ToString(imgFile[0].GroupImage);
                    }
                    else
                    {
                        itemGroupDto.GroupImage = fileName;
                    }
                }
                itemGroupDto.GroupName  = System.Web.HttpContext.Current.Request["GroupName"];
                itemGroupDto.GroupDesc  = System.Web.HttpContext.Current.Request["GroupDesc"];
                itemGroupDto.CreatedBy  = Convert.ToInt32(Session["AdminId"]);
                itemGroupDto.ModifiedBy = Convert.ToInt32(Session["AdminId"]);
                itemGroupDto.IsActive   = 1;

                int i = itemGroupDal.SaveItemGroup(itemGroupDto);
                return(Json(i, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }