Exemplo n.º 1
0
        public object UpdateGrievance(GrievanceParam PR)
        {
            try
            {
                tbl_grievance_list obGR = db.tbl_grievance_list.Where(r => r.grivance_id == PR.GrievanceId).FirstOrDefault();

                obGR.grivance_name        = PR.GrievanceName;
                obGR.grivance_description = PR.GrievanceDescription;
                obGR.Isalloted            = 0;

                //db.tbl_user.Add(objuser);
                db.SaveChanges();

                return(new Result()
                {
                    IsSucess = true, ResultData = "Grievance Update Successfully."
                });
            }
            catch (Exception ex)
            {
                return(new Error()
                {
                    IsError = true, Message = ex.Message
                });
            }
        }
Exemplo n.º 2
0
        public object UpdateGrievanceAllocation(GrievanceAllocationParam PR)
        {
            try
            {
                tbl_member obGR = db.tbl_member.Where(r => r.UserId == PR.UserId).FirstOrDefault();

                obGR.griType       = PR.griType;
                obGR.designation   = PR.designation;
                obGR.modified_date = DateTime.Now;
                //db.tbl_user.Add(objuser);
                db.SaveChanges();

                tbl_grievance_list objgrlist = db.tbl_grievance_list.Where(r => r.grivance_name == PR.griType).FirstOrDefault();
                objgrlist.Isalloted = 1;
                db.SaveChanges();

                tbl_user objuser = db.tbl_user.Where(r => r.UserId == PR.UserId).FirstOrDefault();
                objuser.name    = PR.name;
                objuser.code    = PR.code;
                objuser.email   = PR.email;
                objuser.contact = PR.contact;
                db.SaveChanges();
                return(new Result()
                {
                    IsSucess = true, ResultData = "Grievance Update Successfully."
                });
            }
            catch (Exception ex)
            {
                return(new Error()
                {
                    IsError = true, Message = ex.Message
                });
            }
        }
Exemplo n.º 3
0
        public object GrievanceSave(GrievanceParam PR)
        {
            try
            {
                //var usercode = db.tbl_user.Where(r => r.code == PR.Code).FirstOrDefault();
                if (PR.GrievanceName == null)
                {
                    return(new Error()
                    {
                        IsError = true, Message = "Required Grievance Name"
                    });
                }
                tbl_grievance_list objuser = new tbl_grievance_list();
                var result = db.tbl_grievance_list.Where(r => r.grivance_name == PR.GrievanceName);
                if (result != null)
                {
                    return(new Error()
                    {
                        IsError = true, Message = "Duplicate Entry Not Allowd"
                    });
                }

                objuser.grivance_name        = PR.GrievanceName;
                objuser.grivance_description = PR.GrievanceDescription;
                objuser.Display      = 1;
                objuser.created_date = DateTime.Now;

                objuser.Isalloted = 0;
                db.tbl_grievance_list.Add(objuser);
                db.SaveChanges();


                return(new Result()
                {
                    IsSucess = true, ResultData = "User Saved Successfully."
                });
            }
            catch (Exception ex)
            {
                return(new Error()
                {
                    IsError = true, Message = ex.Message
                });
            }
        }
Exemplo n.º 4
0
        public object UpdateMemberDetail(MemberParameter PR)
        {
            GRContext db = new GRContext();

            try
            {
                tbl_member objmember = db.tbl_member.Where(r => r.UserId == PR.UserId).FirstOrDefault();

                objmember.griType       = PR.GriType;
                objmember.designation   = PR.Designation;
                objmember.modified_date = DateTime.Now;
                if (PR.GriType != null)
                {
                    objmember.griType = PR.GriType;
                    tbl_grievance_list list = db.tbl_grievance_list.Where(r => r.grivance_name == objmember.griType).FirstOrDefault();
                    list.Isalloted = 1;
                    db.SaveChanges();
                }
                db.SaveChanges();

                tbl_user objuser = db.tbl_user.Where(r => r.UserId == PR.UserId).FirstOrDefault();
                objuser.name    = PR.Name;
                objuser.gender  = PR.Gender;
                objuser.email   = PR.EmailId;
                objuser.contact = PR.MobileNo;

                db.SaveChanges();


                return(new Result()
                {
                    IsSucess = true, ResultData = "Member Updated Successfully."
                });
            }
            catch (Exception ex)
            {
                return(new Error()
                {
                    IsError = true, Message = ex.Message
                });
            }
        }
Exemplo n.º 5
0
        public object SaveMember([FromBody] MemberParameter obj)
        {
            GRContext db       = new GRContext();
            var       usercode = db.tbl_member.Where(r => r.code == obj.Code).FirstOrDefault();

            if (usercode != null)
            {
                return(new Error()
                {
                    IsError = true, Message = "User Code Already Exists."
                });
            }


            tbl_user objuser = new tbl_user();

            objuser.name         = obj.Name.ToString();
            objuser.UserId       = Convert.ToInt32(obj.UserId);
            objuser.code         = obj.Code;
            objuser.type         = "Member";
            objuser.gender       = obj.Gender.ToString();
            objuser.email        = obj.EmailId.ToString();
            objuser.contact      = Convert.ToInt64(obj.MobileNo);
            objuser.password     = CryptIt.Encrypt(obj.Password);
            objuser.status       = 1;
            objuser.Islive       = 0;
            objuser.Display      = 1;
            objuser.created_date = DateTime.Now;

            db.tbl_user.Add(objuser);

            try
            {
                db.SaveChanges();
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)
            {
                Exception raise = dbEx;
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        string message = string.Format("{0}:{1}",
                                                       validationErrors.Entry.Entity.ToString(),
                                                       validationError.ErrorMessage);
                        // raise a new exception nesting
                        // the current instance as InnerException
                        raise = new InvalidOperationException(message, raise);
                    }
                }
                throw raise;
            }
            tbl_member objmember = new tbl_member();
            tbl_user   omember   = db.tbl_user.Where(r => r.code == obj.Code).FirstOrDefault();

            objmember.UserId      = omember.UserId;
            objmember.code        = Convert.ToInt32(obj.Code);
            objmember.designation = obj.Designation.ToString();
            if (obj.GriType != null)
            {
                objmember.griType = obj.GriType.ToString();
            }

            objmember.Display      = 1;
            objmember.created_date = DateTime.Now;
            db.tbl_member.Add(objmember);
            db.SaveChanges();
            if (obj.GriType != null)
            {
                tbl_grievance_list list = db.tbl_grievance_list.Where(r => r.grivance_name == objmember.griType).FirstOrDefault();
                list.Isalloted = 1;
                db.SaveChanges();
            }
            return(new Result
            {
                IsSucess = true,
                ResultData = "Member Created!"
            });
        }
        public object ReportDwonload(int id, string fromdate, string todate, int GriveanceType, int CellMember)
        {
            ViewData["Fromdate"] = fromdate;
            ViewData["Todate"]   = todate;
            if (CellMember != -1)
            {
                tbl_user user       = db.tbl_user.Where(r => r.UserId == CellMember).FirstOrDefault();
                var      membername = user.name;
                ViewData["MemberName"] = membername;
                switch (id)
                {
                case 8:
                    id = 8;
                    var result9 = rpt.GrievanceMemberPendingRpt(fromdate, todate, CellMember);
                    return(View("PendingRCellMember", result9));

                case 9:
                    id = 9;
                    var result10 = rpt.GrievanceMemberClosedRpt(fromdate, todate, CellMember);
                    return(View("ClosedRCellMember", result10));
                }
            }
            if (GriveanceType != -1)
            {
                tbl_grievance_list obGR = db.tbl_grievance_list.Where(r => r.grivance_id == GriveanceType).FirstOrDefault();
                GrievanceNm = obGR.grivance_name;
                switch (id)
                {
                case 5:
                    id = 5;
                    var resul5 = rpt.GRDetailedReport(fromdate, todate, GrievanceNm);
                    return(View("DetailedRGriType", resul5));

                case 6:
                    id = 6;
                    var result7 = rpt.GRDetailedClosedReport(fromdate, todate, GrievanceNm);
                    return(View("ClosedRGriType", result7));

                case 7:
                    id = 7;
                    var result6 = rpt.GRDetailedPendingReport(fromdate, todate, GrievanceNm);
                    return(View("PendingRGriType", result6));
                }
            }
            switch (id)
            {
            case 1:
                id = 1;
                var result1 = rpt.ShowGraphFunction();
                return(View("ConsolidatedGrievance", result1));

            case 2:
                id = 2;
                var result7 = rpt.DetailedReport(fromdate, todate);
                return(View("DetailedGrievance", result7));

            case 3:
                id = 3;

                var result = rpt.GetGrievanceList(fromdate, todate);
                ViewData["resultData"] = result;
                return(View("PendingGrievance", result));

            case 4:
                id = 4;
                var result4 = rpt.ClosedGrievance(fromdate, todate);
                return(View("ClosedGrievance", result4));
            }

            return(null);
        }