public Result UpadteBrandingIssueSolvedInfo(BrandIssueMaster brandingIssue)
        {
            var result = new Result();

            try
            {
                result.IsSuccess = iBrandingIssuesSolved.UpadteBrandingIssueSolvedInfo(brandingIssue);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(result);
        }
Exemplo n.º 2
0
        public JsonResult InsertBrandingIssueSolvedInfo(BrandingIssuesSolved brandingIssue, string status)
        {
            var result   = new Result();
            var upresult = new Result();
            var bIssues  = new BrandIssueMaster();

            if (status.ToLower() == "completed")
            {
                brandingIssue.AddedDate = DateTime.Now;
                brandingIssue.AddedBy   = 1;
                result = _brandingIssueSolvedManager.InsertBrandingIssueSolvedInfo(brandingIssue);


                if (result.IsSuccess)
                {
                    bIssues.IssueId    = brandingIssue.IssueId;
                    bIssues.SolvedDate = DateTime.Now;
                    bIssues.SolvedBy   = brandingIssue.AddedBy;
                    bIssues.Active     = false;
                    bIssues.Solved     = true;
                    upresult           = _brandingIssueSolvedManager.UpadteBrandingIssueSolvedInfo(bIssues);
                }

                if (upresult.IsSuccess)

                {
                    TempData["success"] = "Completed Successfully";
                }
            }

            if (status.ToLower() == "trash")
            {
                bIssues.IssueId   = brandingIssue.IssueId;
                bIssues.TrashDate = DateTime.Now;
                bIssues.TrashBy   = brandingIssue.AddedBy;
                bIssues.Trash     = true;
                bIssues.Active    = false;
                upresult          = _brandingIssueSolvedManager.UpadteBrandingIssueSolvedInfo(bIssues);

                if (upresult.IsSuccess)
                {
                    TempData["success"] = "Moved To Trash  Successfully";
                }
            }

            if (status.ToLower() == "trashactive")
            {
                bIssues.IssueId      = brandingIssue.IssueId;
                bIssues.ReActiveDate = DateTime.Now;
                bIssues.ReActiveBy   = brandingIssue.AddedBy;
                bIssues.Trash        = false;
                bIssues.Active       = true;
                upresult             = _brandingIssueSolvedManager.UpadteBrandingIssueSolvedInfo(bIssues);

                if (upresult.IsSuccess)
                {
                    TempData["success"] = "Moved To Trash  Successfully";
                }
            }



            try
            {
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Json(upresult));
        }
Exemplo n.º 3
0
        public Result PostDescription()
        {
            var masterResult = new Result();
            var result       = new Result();

            var brandingIssue       = new BrandingIssue();
            var brandingIssueMaster = new BrandIssueMaster();

            const string initialPath = @"~/Content/UploadImage";


            try
            {
                //****Posted Files
                //****Posted Files

                var httpPostedFile = HttpContext.Current.Request.Files;
// ReSharper disable once AssignNullToNotNullAttribute
                var strings             = HttpContext.Current.Request.Form.GetValues("desc").ToList();
                var stringsAddress      = HttpContext.Current.Request.Form.GetValues("add");
                var stringPhone         = HttpContext.Current.Request.Form.GetValues("phone");
                var stringSubcategoryId = HttpContext.Current.Request.Form.GetValues("subcategoryid");
                var stringCategoryId    = HttpContext.Current.Request.Form.GetValues("categoryid");

                //Strings Bind

                //string bind

                string description = null;
                string address     = null;
                string phone       = null;

                long?categoryid    = null;
                long?subcategoryid = null;
                if (strings != null)
                {
                    description = strings[0];
                }

                if (stringsAddress != null)
                {
                    address = stringsAddress[0];
                }

                if (stringPhone != null)
                {
                    phone = stringPhone[0];
                }

                if (stringSubcategoryId != null)
                {
                    subcategoryid = Convert.ToInt64(stringSubcategoryId[0]);
                }

                if (stringCategoryId != null)
                {
                    categoryid = Convert.ToInt64(stringCategoryId[0]);
                }



                //****Posted Files
                //****Posted Files
                // Get the uploaded image from the Files collection
                // Get the uploaded image from the Files collection
                var bmEntity = new BrandOutletMonitoringEntities();

                var issueToken = Guid.NewGuid();


                brandingIssueMaster.IssueId          = issueToken;
                brandingIssueMaster.CategoryId       = categoryid;
                brandingIssueMaster.SubCategoryId    = subcategoryid;
                brandingIssueMaster.Description      = description;
                brandingIssueMaster.RetailersPhone   = phone;
                brandingIssueMaster.RetailersAddress = address;
                brandingIssueMaster.Active           = true;
                brandingIssueMaster.AddedDate        = DateTime.Now;

                bmEntity.BrandIssueMasters.Add(brandingIssueMaster);
                masterResult.issuccess = bmEntity.SaveChanges();
                if (masterResult.issuccess == 1)
                {
                    result.error   = false;
                    result.message = "Uploaded Successfully";

                    if (HttpContext.Current.Request.Files.AllKeys.Any())
                    {
                        for (var iCnt = 0; iCnt <= httpPostedFile.Count - 1; iCnt++)
                        {
                            var postedFile = httpPostedFile[iCnt];

                            var fileName = Path.GetFileName(postedFile.FileName);


                            if (fileName != null)
                            {
                                var todayTime = DateTime.Now;
                                var time      = new DateTime(todayTime.Year, todayTime.Month, todayTime.Day,
                                                             todayTime.Hour,
                                                             todayTime.Minute, todayTime.Second, todayTime.Millisecond);
                                var timeFormat = string.Format("{0:yyyy-MM-dd_hh-mm-ss-fff}", time);
                                fileName = timeFormat + "-" + fileName;
                                var path = Path.Combine(HttpContext.Current.Server.MapPath(initialPath), fileName);
                                postedFile.SaveAs(path);


                                string finalPath = @"C:\uploads" + @"\" + 1 + @"\" + 2 + @"\" + 3;
                                if (Directory.Exists(finalPath))
                                {
                                    File.Copy(path, finalPath + "\\" + fileName, true);
                                }
                                else
                                {
                                    Directory.CreateDirectory(finalPath);
                                    File.Copy(path, finalPath + "\\" + fileName, true);
                                }

                                brandingIssue.BrandIssueId = issueToken;
                                brandingIssue.IssueFile    = finalPath + "\\" + fileName;
                                bmEntity.BrandingIssues.Add(brandingIssue);
                                bmEntity.SaveChanges();

                                result.error   = false;
                                result.message = "Uploaded Successfully";
                            }
                        }
                    }
                }

                else
                {
                    result.error   = true;
                    result.message = "Uploaded Failed";
                }


                //var httpPostedFile = HttpContext.Current.Request.Files["upload"];
                //
            }
            catch (Exception)
            {
                result.error   = true;
                result.message = "Uploaded Failed";
            }


            return(result);
        }
        public bool UpadteBrandingIssueSolvedInfo(BrandIssueMaster branding)
        {
            try
            {
                var brandings = _entities.BrandIssueMasters.FirstOrDefault(x => x.IssueId == branding.IssueId);
                if (brandings != null)
                {
                    if (branding.AddedBy != null)
                    {
                        brandings.AddedBy = branding.AddedBy;
                    }

                    if (branding.AddedDate != null)
                    {
                        brandings.AddedDate = branding.AddedDate;
                    }

                    if (branding.SolvedBy != null)
                    {
                        brandings.SolvedBy = branding.SolvedBy;
                    }


                    if (branding.SolvedDate != null)
                    {
                        brandings.SolvedDate = branding.SolvedDate;
                    }


                    if (branding.TrashBy != null)
                    {
                        brandings.TrashBy = branding.TrashBy;
                    }


                    if (branding.TrashBy != null)
                    {
                        brandings.TrashDate = branding.TrashDate;
                    }



                    if (branding.ReActiveBy != null)
                    {
                        brandings.ReActiveBy = branding.ReActiveBy;
                    }


                    if (branding.ReActiveDate != null)
                    {
                        brandings.ReActiveDate = branding.ReActiveDate;
                    }

                    if (branding.Active != null)
                    {
                        brandings.Active = branding.Active;
                    }

                    if (branding.Trash != null)
                    {
                        brandings.Trash = branding.Trash;
                    }

                    if (branding.Seen != null)
                    {
                        brandings.Seen = branding.Seen;
                    }

                    if (branding.Solved != null)
                    {
                        brandings.Solved = branding.Solved;
                    }

                    _entities.Entry(brandings).State = EntityState.Modified;
                    _entities.SaveChanges();
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception exception)
            {
                throw exception;
            }

            //finally
            //{

            //    EntityDispose(true);

            //}



            return(true);
        }