Exemple #1
0
        public object UpdateUser(ParamRegistration PR)
        {
            try
            {
                tbl_user obj = context.tbl_user.Where(r => r.UserId == PR.UserId).FirstOrDefault();

                if (PR.Password == null)
                {
                    obj.name    = PR.Name;
                    obj.email   = PR.Email;
                    obj.contact = PR.Contact;
                    //obj.password = PR.Password;
                }
                else
                {
                    obj.name     = PR.Name;
                    obj.email    = PR.Email;
                    obj.contact  = PR.Contact;
                    obj.password = CryptIt.Encrypt(PR.Password);
                }
                context.SaveChanges();
                return(new Result()
                {
                    IsSucess = true, ResultData = "User Updated Successfully."
                });
            }
            catch (Exception ex)
            {
                return(new Error()
                {
                    IsError = true, Message = ex.Message
                });
            }
        }
Exemple #2
0
        public object DeleteGrievanceAllocation(ParamRegistration PR)
        {
            try
            {
                tbl_member objmember = db.tbl_member.Where(r => r.UserId == PR.UserId).FirstOrDefault();

                if (objmember.Display == 1)
                {
                    objmember.Display = 0;
                }
                else
                {
                    objmember.Display = 1;
                }

                db.SaveChanges();

                return(new Result()
                {
                    IsSucess = true, ResultData = "Member Updated Successfully."
                });
            }
            catch (Exception ex)
            {
                return(new Error()
                {
                    IsError = true, Message = ex.Message
                });
            }
        }
Exemple #3
0
 public object DeleteParentInfo([FromBody] ParamRegistration PR)
 {
     try
     {
         SaveRegistrationBL Objdelete = new SaveRegistrationBL();
         var result = Objdelete.DeleteParent(PR);
         return(result);
     }
     catch (Exception e)
     {
         return(new Error()
         {
             IsError = true, Message = e.Message
         });
     }
 }
Exemple #4
0
 public object DeleteStudents([FromBody] ParamRegistration PR)
 {
     try
     {
         SaveRegistrationBL OBJSAVE = new SaveRegistrationBL();
         var result = OBJSAVE.DeleteSingleStudent(PR);
         return(result);
     }
     catch (Exception e)
     {
         return(new Error()
         {
             IsError = true, Message = e.Message
         });
     }
 }
Exemple #5
0
 public object DeleteStaffInformation([FromBody] ParamRegistration PR)
 {
     try
     {
         SaveRegistrationBL ObjSvreg = new SaveRegistrationBL();
         var result = ObjSvreg.DeleteStaff(PR);
         return(result);
     }
     catch (Exception e)
     {
         return(new Error()
         {
             IsError = true, Message = e.Message
         });
     }
 }
Exemple #6
0
 public object UpdateStaffInfo([FromBody] ParamRegistration PR)
 {
     try
     {
         SaveRegistrationBL OBJSAVE = new SaveRegistrationBL();
         var result = OBJSAVE.UpdateStaff(PR);
         return(result);
     }
     catch (Exception e)
     {
         return(new Error()
         {
             IsError = true, Message = e.Message
         });
     }
 }
 public object UpdateUsers([FromBody] ParamRegistration objid)
 {
     try
     {
         UsersBusiness obj      = new UsersBusiness();
         var           userlist = obj.UpdateUser(objid);
         return(userlist);
     }
     catch (Exception ex)
     {
         return(new Error()
         {
             IsError = true, Message = ex.Message
         });
     }
 }
Exemple #8
0
 public object DeleteGrievanceAllocation([FromBody] ParamRegistration PR)
 {
     try
     {
         SaveGrievance Objdelete = new SaveGrievance();
         var           result    = Objdelete.DeleteGrievanceAllocation(PR);
         return(result);
     }
     catch (Exception e)
     {
         return(new Error()
         {
             IsError = true, Message = e.Message
         });
     }
 }
Exemple #9
0
        public object DeleteSingleStudent(ParamRegistration PR)
        {
            try
            {
                tbl_user objuser = db.tbl_user.Where(r => r.UserId == PR.UserId).FirstOrDefault();

                if (objuser.Display == 1)
                {
                    objuser.Display = 0;
                }
                else
                {
                    objuser.Display = 1;
                }



                db.SaveChanges();

                if (PR.Type == "Student")
                {
                    tbl_student objstudent = db.tbl_student.Where(r => r.UserId == PR.UserId).FirstOrDefault();
                    if (objstudent.Display == 1)
                    {
                        objstudent.Display = 0;
                    }
                    else
                    {
                        objstudent.Display = 1;
                    }

                    db.SaveChanges();
                }

                return(new Result()
                {
                    IsSucess = true, ResultData = "User Deleted Successfully."
                });
            }
            catch (Exception ex)
            {
                return(new Error()
                {
                    IsError = true, Message = ex.Message
                });
            }
        }
Exemple #10
0
        public object DeleteFaculty(ParamRegistration PR)
        {
            try
            {
                tbl_user objuser = db.tbl_user.Where(r => r.UserId == PR.UserId).FirstOrDefault();


                if (objuser.Display == 1)
                {
                    objuser.Display = 0;
                }
                else
                {
                    objuser.Display = 1;
                }
                db.SaveChanges();



                if (PR.Type == "Faculty")
                {
                    tbl_faculty objfaculty = db.tbl_faculty.Where(r => r.UserId == PR.UserId).FirstOrDefault();
                    // objparent.UserId = PR.UserId;
                    if (objfaculty.Display == 1)
                    {
                        objfaculty.Display = 0;
                    }
                    else
                    {
                        objfaculty.Display = 1;
                    }
                    db.SaveChanges();
                }

                return(new Result()
                {
                    IsSucess = true, ResultData = "User Updated Successfully."
                });
            }
            catch (Exception ex)
            {
                return(new Error()
                {
                    IsError = true, Message = ex.Message
                });
            }
        }
Exemple #11
0
        public object UpdateStaff(ParamRegistration PR)
        {
            try
            {
                tbl_user objuser = db.tbl_user.Where(r => r.UserId == PR.UserId).FirstOrDefault();


                objuser.name = PR.Name;

                objuser.type          = PR.Type;
                objuser.gender        = PR.Gender;
                objuser.email         = PR.Email;
                objuser.contact       = PR.Contact;
                objuser.modified_date = DateTime.Now;
                objuser.status        = 1;
                objuser.Islive        = 1;

                db.SaveChanges();

                if (PR.Type == "Staff")
                {
                    tbl_staff objstaff = db.tbl_staff.Where(r => r.UserId == PR.UserId).FirstOrDefault();

                    objstaff.department    = PR.Department;
                    objstaff.designation   = PR.Designation;
                    objstaff.modified_date = DateTime.Now;
                    db.SaveChanges();
                }

                return(new Result()
                {
                    IsSucess = true, ResultData = "User Saved Successfully."
                });
            }
            catch (Exception ex)
            {
                return(new Error()
                {
                    IsError = true, Message = ex.Message
                });
            }
        }
Exemple #12
0
        public object UpdateParent(ParamRegistration PR)
        {
            try
            {
                tbl_user objuser = db.tbl_user.Where(r => r.UserId == PR.UserId).FirstOrDefault();


                objuser.name = PR.Name;

                objuser.gender        = PR.Gender;
                objuser.email         = PR.Email;
                objuser.contact       = PR.Contact;
                objuser.modified_date = DateTime.Now;

                objuser.status = 1;
                objuser.Islive = 1;

                db.SaveChanges();

                if (PR.Type == "Parent")
                {
                    tbl_parent objparent = db.tbl_parent.Where(r => r.UserId == PR.UserId).FirstOrDefault();
                    // objparent.UserId = PR.UserId;
                    objparent.relationship  = PR.Relationship;
                    objparent.modified_date = DateTime.Now;
                    db.SaveChanges();
                }

                return(new Result()
                {
                    IsSucess = true, ResultData = "User Updated Successfully."
                });
            }
            catch (Exception ex)
            {
                return(new Error()
                {
                    IsError = true, Message = ex.Message
                });
            }
        }
Exemple #13
0
        public object SaveRegistration(ParamRegistration PR)
        {
            try
            {
                var usercode = db.tbl_user.Where(r => r.code == PR.code).FirstOrDefault();
                if (usercode != null)
                {
                    return(new Error()
                    {
                        IsError = true, Message = "User Code Already Exists."
                    });
                }
                tbl_user objuser = new tbl_user();

                objuser.name    = PR.Name;
                objuser.UserId  = PR.UserId;
                objuser.type    = PR.Type;
                objuser.gender  = PR.Gender;
                objuser.code    = PR.code;
                objuser.email   = PR.Email;
                objuser.contact = PR.Contact;
                string EncryptedPassword = CryptIt.Encrypt(PR.Password);
                objuser.password     = EncryptedPassword;
                objuser.status       = 1;
                objuser.Islive       = 1;
                objuser.Display      = 1;
                objuser.created_date = DateTime.Now;
                db.tbl_user.Add(objuser);
                db.SaveChanges();

                if (PR.Type == "Student")
                {
                    tbl_student objstudent = new tbl_student();
                    objstudent.UserId = PR.UserId;
                    tbl_user obstudent = db.tbl_user.Where(r => r.code == PR.code).FirstOrDefault();
                    objstudent.UserId       = obstudent.UserId;
                    objstudent.code         = PR.code;
                    objstudent.course_name  = PR.CourseName;
                    objstudent.class_name   = PR.ClassName;
                    objstudent.IsParent     = 0;
                    objstudent.Display      = 1;
                    objstudent.created_date = DateTime.Now;
                    db.tbl_student.Add(objstudent);
                    db.SaveChanges();
                }
                else if (PR.Type == "Faculty")
                {
                    tbl_faculty objfaculty = new tbl_faculty();
                    objfaculty.UserId = PR.UserId;
                    tbl_user obfaculty = db.tbl_user.Where(r => r.code == PR.code).FirstOrDefault();
                    objfaculty.UserId       = obfaculty.UserId;
                    objfaculty.code         = PR.code;
                    objfaculty.department   = PR.CourseName;
                    objfaculty.designation  = PR.Designation;
                    objfaculty.Display      = 1;
                    objfaculty.created_date = DateTime.Now;
                    db.tbl_faculty.Add(objfaculty);
                    db.SaveChanges();
                }
                else if (PR.Type == "Parent")
                {
                    tbl_parent objparent = new tbl_parent();
                    objparent.UserId       = PR.UserId;
                    objparent.relationship = PR.Relationship;
                    tbl_user obstudent = db.tbl_user.Where(r => r.code == PR.code).FirstOrDefault();
                    objparent.UserId       = obstudent.UserId;
                    objparent.code         = PR.code;
                    objparent.Display      = 1;
                    objparent.created_date = DateTime.Now;
                    db.tbl_parent.Add(objparent);
                    db.SaveChanges();
                    //tbl_student objstudent = db.tbl_student.Where(r => r.UserId == PR.UserId).FirstOrDefault();
                    //objstudent.IsParent = 1;
                    //db.SaveChanges();
                }
                else if (PR.Type == "Staff")
                {
                    tbl_staff objstaff = new tbl_staff();
                    objstaff.UserId = objuser.UserId;
                    tbl_user obstaff = db.tbl_user.Where(r => r.code == PR.code).FirstOrDefault();
                    objstaff.UserId       = objstaff.UserId;
                    objstaff.code         = PR.code;
                    objstaff.department   = PR.CourseName;
                    objstaff.designation  = PR.Designation;
                    objstaff.Display      = 1;
                    objstaff.created_date = DateTime.Now;
                    db.tbl_staff.Add(objstaff);
                    db.SaveChanges();
                }
                else
                {
                    return(new Error()
                    {
                        IsError = true, Message = "User Type Not Matched."
                    });
                }
                return(new Result()
                {
                    IsSucess = true, ResultData = "User Saved Successfully."
                });
            }
            catch (Exception ex)
            {
                return(new Error()
                {
                    IsError = true, Message = ex.Message
                });
            }
        }
Exemple #14
0
        public object DeleteSingleStudent(ParamRegistration PR)
        {
            try
            {
                string   res     = "";
                tbl_user objuser = db.tbl_user.Where(r => r.UserId == PR.UserId).FirstOrDefault();

                if (objuser.Display == 1)
                {
                    objuser.Display = 0;
                }
                else
                {
                    objuser.Display = 1;
                }



                db.SaveChanges();

                if (PR.Type == "Student")
                {
                    tbl_student objstudent = db.tbl_student.Where(r => r.UserId == PR.UserId).FirstOrDefault();
                    if (objstudent.Display == 1)
                    {
                        objstudent.Display = 0;
                    }
                    else
                    {
                        objstudent.Display = 1;
                    }

                    db.SaveChanges();

                    if (objstudent.Display == 1)
                    {
                        if (objuser.name.Length > 0)
                        {
                            string appset = ConfigurationManager.AppSettings["BaseEmailUrl"];
                            res = " <b>Dear " + objuser.name + "</b>, Your account for griveance redressal system has been activated by the admin,<a href='" + appset + "'>click here</a> to login your account ";
                        }

                        try
                        {
                            Email objemail = new Email();
                            bool  IsDelete;
                            if (objuser.email.Length > 0)
                            {
                                //IsDelete = objSMS.SMSSend(MobNo, res);
                                IsDelete = objemail.SendEmail(objuser.email, res, "Active Status", "", "", "", "");
                            }

                            return(res);
                        }
                        catch (Exception e)
                        {
                            return(new Error()
                            {
                                IsError = true, Message = e.Message
                            });
                        }
                    }
                }
                return(new Result()
                {
                    IsSucess = true, ResultData = "User Deleted Successfully."
                });
            }
            catch (Exception ex)
            {
                return(new Error()
                {
                    IsError = true, Message = ex.Message
                });
            }
        }