Пример #1
0
        public List <Employee_t> FindByName(string Username, string Password)
        {
            try
            {
                using (PerformanceAppEntities db = new PerformanceAppEntities())
                {
                    var query = from c in db.Employee_t
                                where c.Username.Contains(Username) && c.Password.Contains(Password)
                                select c;
                    return(query.ToList());
                }
            }
            catch (Exception ex)
            {
                using (PerformanceAppEntities db = new PerformanceAppEntities())
                {
                    Log_t log = new Log_t();
                    log.Error_Message = ex.Message;

                    log.Page     = "Login";
                    log.Method   = "FindByName";
                    log.Datetime = DateTime.Now;
                    db.Log_t.Add(log);
                    db.SaveChanges();
                    Response.Redirect("~/Login.aspx", false);
                }
                return(null);
            }
        }
        protected void logout_Click(object sender, EventArgs e)
        {
            try
            {
                Session.Remove("Employee");
                if (Session["appraisal"] != null)
                {
                    Session.Remove("appraisal");
                }
                Response.Redirect("~/Login.aspx?logout=1", false);
            }
            catch (Exception ex)
            {
                using (PerformanceAppEntities db = new PerformanceAppEntities())
                {
                    Log_t log = new Log_t();
                    log.Error_Message = ex.Message;

                    log.Page     = "Dashboard";
                    log.Method   = "logout_Click";
                    log.Datetime = DateTime.Now;
                    db.Log_t.Add(log);
                    db.SaveChanges();
                    Response.Redirect("~/Login.aspx", false);
                }
            }
        }
Пример #3
0
        protected void Next_Click(object sender, EventArgs e)
        {
            try
            {
                Session["Understanding"]  = Understanding.Text;
                Session["Responsibility"] = Responsibility.Text;
                Session["From"]           = FromTextBox.Text;
                Session["To"]             = ToTextBox.Text;
                //Save();
                Response.Redirect("~/PerformanceAppraisal3.aspx?type=" + type.ToString(), false);
            }
            catch (Exception ex)
            {
                using (PerformanceAppEntities db = new PerformanceAppEntities())
                {
                    Log_t log = new Log_t();
                    log.Error_Message = ex.Message;

                    log.Page     = "PerformanceAppraisal";
                    log.Method   = "Next_Click";
                    log.Datetime = DateTime.Now;
                    db.Log_t.Add(log);
                    db.SaveChanges();
                    Response.Redirect("~/Login.aspx", false);
                }
            }
        }
Пример #4
0
        private string RandomString(int size)
        {
            try
            {
                StringBuilder builder = new StringBuilder();
                Random        random  = new Random();
                char          ch;
                for (int i = 0; i < size; i++)
                {
                    ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65)));
                    builder.Append(ch);
                }

                return(builder.ToString());
            }
            catch (Exception ex)
            {
                using (PerformanceAppEntities db = new PerformanceAppEntities())
                {
                    Log_t log = new Log_t();
                    log.Error_Message = ex.Message;

                    log.Page     = "ForgotPassword";
                    log.Method   = "RandomString";
                    log.Datetime = DateTime.Now;
                    db.Log_t.Add(log);
                    db.SaveChanges();
                    Response.Redirect("~/Login.aspx", false);
                    return("");
                }
            }
        }
        protected void RevGrid_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            try
            {
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    LinkButton BtnReview = (LinkButton)e.Row.FindControl("BtnReview2");
                    string     Emp_Id    = DataBinder.Eval(e.Row.DataItem, "Emp_Id").ToString();
                    BtnReview.Attributes.Add("Emp_Id", Emp_Id);
                    BtnReview.Attributes.Add("Type", "Rev");

                    if (e.Row.Cells[3].Text.Equals("Not Completed") || e.Row.Cells[3].Text.Equals("partially Completed") || e.Row.Cells[3].Text.Equals("Reviewer Review Completed"))
                    {
                        BtnReview.Enabled = false;
                        BtnReview.Visible = false;
                    }
                }
            }
            catch (Exception ex)
            {
                using (PerformanceAppEntities db = new PerformanceAppEntities())
                {
                    Log_t log = new Log_t();
                    log.Error_Message = ex.Message;

                    log.Page     = "Dashboard";
                    log.Method   = "RevGrid_RowDataBound";
                    log.Datetime = DateTime.Now;
                    db.Log_t.Add(log);
                    db.SaveChanges();
                    Response.Redirect("~/Login.aspx", false);
                }
            }
        }
Пример #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (Request.QueryString["logout"] != null)
                {
                    if (Request.QueryString["logout"].ToString().Contains("1"))
                    {
                        error.Text = "Logged out Successfully";
                    }
                }
            }
            catch (Exception ex)
            {
                using (PerformanceAppEntities db = new PerformanceAppEntities())
                {
                    Log_t log = new Log_t();
                    log.Error_Message = ex.Message;

                    log.Page     = "Login";
                    log.Method   = "Page_Load";
                    log.Datetime = DateTime.Now;
                    db.Log_t.Add(log);
                    db.SaveChanges();
                    Response.Redirect("~/Login.aspx", false);
                }
            }
        }
Пример #7
0
        protected void LoginButton_Click(object sender, EventArgs e)
        {
            try
            {
                List <Employee_t> emp = FindByName(UserNameTextBox.Text, PasswordTextBox.Text);
                Session["Employee"] = emp;
                if (emp != null && emp.Count != 0)
                {
                    Response.Redirect("~/Dashboard.aspx", false);
                }
                else
                {
                    error.Text = "Incorrect Username<br/> and/or Password";
                }
            }
            catch (Exception ex)
            {
                using (PerformanceAppEntities db = new PerformanceAppEntities())
                {
                    Log_t log = new Log_t();
                    log.Error_Message = ex.Message;

                    log.Page     = "Login";
                    log.Method   = "LoginButton_Click";
                    log.Datetime = DateTime.Now;
                    db.Log_t.Add(log);
                    db.SaveChanges();
                    Response.Redirect("~/Login.aspx", false);
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                List <Employee_t> emp = Session["Employee"] as List <Employee_t>;
                if (emp == null)
                {
                    Response.Redirect("~/Login.aspx", false);
                }
                lblError.Text = "";
            }
            catch (Exception ex)
            {
                using (PerformanceAppEntities db = new PerformanceAppEntities())
                {
                    Log_t log = new Log_t();
                    log.Error_Message = ex.Message;

                    log.Page     = "ResetPassword";
                    log.Method   = "Page_Load";
                    log.Datetime = DateTime.Now;
                    db.Log_t.Add(log);
                    db.SaveChanges();
                    Response.Redirect("~/Login.aspx", false);
                }
            }
        }
        protected void ProjectGrid_RowCreated(object sender, GridViewRowEventArgs e)
        {
            try
            {
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    DropDownList combo1 = (DropDownList)e.Row.FindControl("SelfRating");
                    combo1.DataSource = RatingItem;
                    combo1.DataBind();
                    DropDownList combo2 = (DropDownList)e.Row.FindControl("AppraiserRating");
                    combo2.DataSource = RatingItem;
                    combo2.DataBind();
                }
            }
            catch (Exception ex)
            {
                using (PerformanceAppEntities db = new PerformanceAppEntities())
                {
                    Log_t log = new Log_t();
                    log.Error_Message = ex.Message;

                    log.Page     = "PerformanceAppraisal3";
                    log.Method   = "ProjectGrid_RowCreated";
                    log.Datetime = DateTime.Now;
                    db.Log_t.Add(log);
                    db.SaveChanges();
                    Response.Redirect("~/Login.aspx", false);
                }
            }
        }
Пример #10
0
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                Save();
                Session["isSaved"] = 1;
                using (PerformanceAppEntities db = new PerformanceAppEntities())
                {
                    var query = db.Appraisal_t.Where(m => m.EmpId == empId);

                    if (query.Count() != 0)
                    {
                        Appraisal_t app_raisal = query.Single();
                        app_raisal.Status = 1;
                        db.SaveChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                using (PerformanceAppEntities db = new PerformanceAppEntities())
                {
                    Log_t log = new Log_t();
                    log.Error_Message = ex.Message;

                    log.Page     = "PerformanceAppraisal";
                    log.Method   = "BtnSave_Click";
                    log.Datetime = DateTime.Now;
                    db.Log_t.Add(log);
                    db.SaveChanges();
                    Response.Redirect("~/Login.aspx", false);
                }
            }
        }
        protected void ProjectGrid_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            try
            {
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    DropDownList combo1 = (DropDownList)e.Row.FindControl("SelfRating");
                    DropDownList combo2 = (DropDownList)e.Row.FindControl("AppraiserRating");

                    TextBox text1 = (TextBox)e.Row.FindControl("SelfComment");
                    TextBox text2 = (TextBox)e.Row.FindControl("AppraiserComment");

                    if (type == 0)
                    {
                        //combo2.Enabled = false;
                        text2.Enabled = false;
                    }
                    else if (type == 1)
                    {
                        combo1.Enabled = false;
                        text1.Enabled  = false;
                    }
                    else if (type == 2)
                    {
                        combo1.Enabled = false;
                        combo2.Enabled = false;
                        text1.Enabled  = false;
                        text2.Enabled  = false;
                    }
                }
            }
            catch (Exception ex)
            {
                using (PerformanceAppEntities db = new PerformanceAppEntities())
                {
                    Log_t log = new Log_t();
                    log.Error_Message = ex.Message;

                    log.Page     = "PerformanceAppraisal3";
                    log.Method   = "ProjectGrid_RowDataBound";
                    log.Datetime = DateTime.Now;
                    db.Log_t.Add(log);
                    db.SaveChanges();
                    Response.Redirect("~/Login.aspx", false);
                }
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                List <Employee_t> emp = Session["Employee"] as List <Employee_t>;
                using (PerformanceAppEntities db = new PerformanceAppEntities())
                {
                    string Username = emp[0].Username;
                    var    query    = db.Employee_t.Where(m => m.Password == OldTextBox.Text.Trim() && m.Username == Username);
                    if (query.Count() != 0)
                    {
                        Employee_t employee = query.Single();
                        employee.Password = NewTextBox.Text;
                        employee.PwdReset = 0;
                        db.SaveChanges();
                        lblError.Text   = "";
                        emp[0].Password = NewTextBox.Text;
                        emp[0].PwdReset = 0;
                        Response.Redirect("~/Dashboard.aspx", false);
                    }
                    else
                    {
                        lblError.Text = "Please enter correct old password";
                    }
                }
            }
            catch (Exception ex)
            {
                using (PerformanceAppEntities db = new PerformanceAppEntities())
                {
                    Log_t log = new Log_t();
                    log.Error_Message = ex.Message;

                    log.Page     = "ResetPassword";
                    log.Method   = "btnSubmit_Click";
                    log.Datetime = DateTime.Now;
                    db.Log_t.Add(log);
                    db.SaveChanges();
                    Response.Redirect("~/Login.aspx", false);
                }
            }
        }
Пример #13
0
        protected void BtnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
            }
            catch (Exception ex)
            {
                using (PerformanceAppEntities db = new PerformanceAppEntities())
                {
                    Log_t log = new Log_t();
                    log.Error_Message = ex.Message;

                    log.Page     = "PerformanceAppraisal";
                    log.Method   = "BtnSubmit_Click";
                    log.Datetime = DateTime.Now;
                    db.Log_t.Add(log);
                    db.SaveChanges();
                    Response.Redirect("~/Login.aspx", false);
                }
            }
        }
        protected void BtnReview_Click(object sender, EventArgs e)
        {
            try
            {
                LinkButton lb     = (LinkButton)sender;
                int        Emp_Id = int.Parse(lb.Attributes["Emp_Id"]);

                if (lb.Attributes["Type"] == "Self")
                {
                    Response.Redirect("~/Performance Appraisal.aspx?EmpId=" + Emp_Id.ToString(), false);
                    Session["Type"] = 0;
                }
                else if (lb.Attributes["Type"] == "App")
                {
                    Response.Redirect("~/Performance Appraisal.aspx?EmpId=" + Emp_Id.ToString(), false);
                    Session["Type"] = 1;
                }
                if (lb.Attributes["Type"] == "Rev")
                {
                    Response.Redirect("~/Performance Appraisal.aspx?EmpId=" + Emp_Id.ToString(), false);
                    Session["Type"] = 2;
                }
            }
            catch (Exception ex)
            {
                using (PerformanceAppEntities db = new PerformanceAppEntities())
                {
                    Log_t log = new Log_t();
                    log.Error_Message = ex.Message;

                    log.Page     = "Dashboard";
                    log.Method   = "BtnReview_Click";
                    log.Datetime = DateTime.Now;
                    db.Log_t.Add(log);
                    db.SaveChanges();
                    Response.Redirect("~/Login.aspx", false);
                }
            }
        }
        protected void btnClose_Click(object sender, EventArgs e)
        {
            try
            {  //Save();
                Response.Redirect("~/PerformanceAppraisal2.aspx?type=" + type.ToString(), false);
            }
            catch (Exception ex)
            {
                using (PerformanceAppEntities db = new PerformanceAppEntities())
                {
                    Log_t log = new Log_t();
                    log.Error_Message = ex.Message;

                    log.Page     = "PerformanceAppraisal3";
                    log.Method   = "btnClose_Click";
                    log.Datetime = DateTime.Now;
                    db.Log_t.Add(log);
                    db.SaveChanges();
                    Response.Redirect("~/Login.aspx", false);
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                emp = Session["Employee"] as List <Employee_t>;
                if (emp == null)
                {
                    Response.Redirect("~/Login.aspx", false);
                }
                empId = emp[0].Emp_Id;

                role = Session["Role"] as Role_t;

                appraisal = Session["appraisal"] as Appraisal_t;

                Rating = new List <int>();

                for (int i = 1; i <= 5; i++)
                {
                    Rating.Add(i);
                }

                RatingItem = new List <string>();
                RatingItem.Add("Extraordinary");
                RatingItem.Add("Exemplary +");
                RatingItem.Add("Exemplary");
                RatingItem.Add("Enabler +");
                RatingItem.Add("Enabler");
                appraisal = Session["appraisal"] as Appraisal_t;
                if (Session["Type"] != null)
                {
                    type = Convert.ToInt32(Session["Type"].ToString());
                }
                if (!Page.IsPostBack)
                {
                    //jquery drop
                    ReviewerRating.DataSource = RatingItem;
                    ReviewerRating.DataBind();
                    using (PerformanceAppEntities db = new PerformanceAppEntities())
                    {
                        string[] CriteriaIds = role.CriteriaIds.Split(';');

                        for (int i = 0; i < CriteriaIds.Length; i++)
                        {
                            Guid        Id             = Guid.Parse(CriteriaIds[i]);
                            Parameter_t Localparameter = db.Parameter_t.Where(m => m.CriteriaId == Id).Single();
                            Parameters.Add(Localparameter);
                        }
                        ProjectGrid.DataSource = Parameters;
                        ProjectGrid.DataBind();
                        if (appraisal != null)
                        {
                            if (appraisal.EmpProjects != null)
                            {
                                ReviewerRating.Text  = appraisal.ProRevRating;
                                ReviewerComment.Text = appraisal.ProRevComment;
                                OtherTextBox.Text    = appraisal.ProAppOtherCmnt;
                                ProjectIds           = appraisal.EmpProjects.Split(';');
                                empProject           = new List <EmpProject_t>();
                                for (int t = 0; t < ProjectIds.Length - 1; t++)
                                {
                                    Guid         ID     = Guid.Parse(ProjectIds[t]);
                                    EmpProject_t empPro = db.EmpProject_t.Where(m => m.EmpProjId == ID).Single();
                                    empProject.Add(empPro);
                                }

                                if (empProject != null)
                                {
                                    int total = 0;
                                    foreach (var item in empProject.OrderBy(order => order.Type))
                                    {
                                        GridViewRow row = ProjectGrid.Rows[total];
                                        if (item.Type == total)
                                        {
                                            DropDownList combo1 = (DropDownList)row.FindControl("SelfRating");
                                            combo1.SelectedValue = item.Self_Rating.ToString();
                                            TextBox text_Self = row.FindControl("SelfComment") as TextBox;
                                            text_Self.Text = item.SelfComments;

                                            DropDownList combo2 = (DropDownList)row.FindControl("AppraiserRating");
                                            combo2.SelectedValue = item.App_Rating.ToString();
                                            TextBox text_App = row.FindControl("AppraiserComment") as TextBox;
                                            text_App.Text = item.AppComments;
                                        }

                                        total++;
                                    }
                                }
                            }
                        }
                    }

                    if (type == 0)
                    {
                        name.Text             = emp[0].Firstname + "&nbsp;" + emp[0].Lastname;
                        Reviwer.Visible       = false;
                        OtherComments.Visible = false;
                        OtherTextBox.Visible  = false;
                    }
                    else
                    {
                        name.Text = Session["Firstname"].ToString() + "&nbsp;" + Session["Lastname"].ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                using (PerformanceAppEntities db = new PerformanceAppEntities())
                {
                    Log_t log = new Log_t();
                    log.Error_Message = ex.Message;

                    log.Page     = "PerformanceAppraisal3";
                    log.Method   = "Page_Load";
                    log.Datetime = DateTime.Now;
                    db.Log_t.Add(log);
                    db.SaveChanges();
                    Response.Redirect("~/Login.aspx", false);
                }
            }
        }
Пример #17
0
        public void Save()
        {
            try
            {
                Session["Understanding"]  = Understanding.Text;
                Session["Responsibility"] = Responsibility.Text;
                Session["From"]           = FromTextBox.Text;
                Session["To"]             = ToTextBox.Text;
                using (PerformanceAppEntities db1 = new PerformanceAppEntities())
                {
                    Appraisal_t appraisals = new Appraisal_t();
                    if (appraisal != null)
                    {
                        int empId = emp[0].Emp_Id;
                        appraisals = db1.Appraisal_t.Where(m => m.EmpId == empId).Single();
                    }
                    else
                    {
                        appraisals.AppId = Guid.NewGuid();
                    }
                    appraisals.EmpId = emp[0].Emp_Id;
                    //appraisals.EmpProjects = Session["EmpProjectId"] as String;
                    //appraisals.EmpSkills = Empskills;
                    //appraisals.SelfOverall = SelfAssessment0.SelectedValue;
                    //appraisals.AssessorOverAll = AssessorRating0.SelectedValue;
                    //appraisals.FinalOverAll = FinalizedRating.SelectedValue;
                    //appraisals.RecPromotion = RecommendedforPromotion0.Text;
                    //appraisals.NotPromoting = notpromoting0.Text;
                    appraisals.DoAssessment         = DateTime.Parse("1753-01-01 00:00:00");
                    appraisals.DoAssessmentDisc     = DateTime.Parse("1753-01-01 00:00:00");
                    appraisals.DoAssessorCompletion = DateTime.Parse("1753-01-01 00:00:00");
                    appraisals.DoFinalization       = DateTime.Parse("1753-01-01 00:00:00");
                    appraisals.Understanding        = Session["Understanding"] as String;
                    appraisals.Responsibility       = Session["Responsibility"] as String;
                    appraisals.From = Convert.ToDateTime(Session["From"] as String);
                    appraisals.To   = Convert.ToDateTime(Session["To"] as String);
                    //appraisals.Weightage = Weightage0.Text;
                    if (appraisal == null)
                    {
                        db1.Appraisal_t.Add(appraisals);
                    }
                    db1.SaveChanges();
                    Session["appraisal"] = appraisals;
                }
            }
            catch (Exception ex)
            {
                using (PerformanceAppEntities db = new PerformanceAppEntities())
                {
                    Log_t log = new Log_t();
                    log.Error_Message = ex.Message;

                    log.Page     = "PerformanceAppraisal";
                    log.Method   = "Save";
                    log.Datetime = DateTime.Now;
                    db.Log_t.Add(log);
                    db.SaveChanges();
                    Response.Redirect("~/Login.aspx", false);
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                emp = Session["Employee"] as List <Employee_t>;

                if (emp != null)
                {
                    if (emp[0].PwdReset == 1)
                    {
                        Response.Redirect("~/ResetPassword.aspx", false);
                    }

                    name.Text = emp[0].Firstname + "" + emp[0].Lastname;
                    using (PerformanceAppEntities db = new PerformanceAppEntities())
                    {
                        int         empId = emp[0].Emp_Id;
                        var         query = db.Appraisal_t.Where(m => m.EmpId == empId);
                        Appraisal_t app   = null;
                        if (query.Count() != 0)
                        {
                            app = query.ToList().Single();
                        }
                        DataTable  Self_Emp = new DataTable();
                        DataColumn Emp_Id   = new DataColumn("Emp_Id", System.Type.GetType("System.Int32"));
                        Self_Emp.Columns.Add(Emp_Id);
                        DataColumn Name = new DataColumn("Name", System.Type.GetType("System.String"));
                        Self_Emp.Columns.Add(Name);
                        DataColumn AppPeriod = new DataColumn("AppPeriod", System.Type.GetType("System.String"));
                        Self_Emp.Columns.Add(AppPeriod);
                        DataColumn AppStatus = new DataColumn("AppStatus", System.Type.GetType("System.String"));
                        Self_Emp.Columns.Add(AppStatus);

                        for (int i = 0; i < emp.Count; i++)
                        {
                            DataRow row = Self_Emp.NewRow();
                            row["Emp_Id"] = emp[i].Emp_Id;
                            row["Name"]   = emp[i].Firstname + "" + emp[i].Lastname;
                            if (app != null)
                            {
                                DateTime from = app.From ?? DateTime.Now;
                                DateTime to   = app.To ?? DateTime.Now;
                                row["AppPeriod"] = from.ToString("dd-MM-yyyy") + " to " + to.ToString("dd-MM-yyyy");
                            }
                            else
                            {
                                row["AppPeriod"] = DateTime.Now.ToString("dd-MM-yyyy") + " to " + DateTime.Now.AddDays(30).ToString("dd-MM-yyyy");
                            }

                            if (app == null)
                            {
                                row["AppStatus"] = "Not Completed";
                            }
                            else if (app.Status == 1 || app.Status == null)
                            {
                                row["AppStatus"] = "partially Completed";
                            }
                            else
                            {
                                row["AppStatus"] = "Completed";
                            }
                            Self_Emp.Rows.Add(row);
                            Self_Emp.AcceptChanges();
                        }
                        if (app != null)
                        {
                            if (app.Status == 0 || app.Status == 1)
                            {
                                SelfGrid.DataSource = Self_Emp;
                                SelfGrid.DataBind();
                            }
                            else
                            {
                                SelfGrid.DataSource = null;
                                SelfGrid.DataBind();
                            }
                        }
                        else
                        {
                            SelfGrid.DataSource = Self_Emp;
                            SelfGrid.DataBind();
                        }


                        var query1 = db.Employee_t.Where(m => m.Appraiser == empId);
                        List <Employee_t> AppEmployee = null;
                        DataTable         App_Emp     = new DataTable();
                        DataColumn        AppEmp_Id   = new DataColumn("Emp_Id", System.Type.GetType("System.Int32"));
                        App_Emp.Columns.Add(AppEmp_Id);
                        DataColumn AppName = new DataColumn("Name", System.Type.GetType("System.String"));
                        App_Emp.Columns.Add(AppName);
                        DataColumn AppPeriod1 = new DataColumn("AppPeriod", System.Type.GetType("System.String"));
                        App_Emp.Columns.Add(AppPeriod1);
                        DataColumn AppStatus1 = new DataColumn("AppStatus", System.Type.GetType("System.String"));
                        App_Emp.Columns.Add(AppStatus1);
                        if (query1.Count() != 0)
                        {
                            AppEmployee = query1.ToList();
                        }
                        else
                        {
                            tabs1.Visible = false;
                        }
                        if (AppEmployee != null)
                        {
                            for (int i = 0; i < AppEmployee.Count; i++)
                            {
                                DataRow row = App_Emp.NewRow();
                                int     Id  = AppEmployee[i].Emp_Id;
                                row["Emp_Id"] = AppEmployee[i].Emp_Id;
                                row["Name"]   = AppEmployee[i].Firstname + "" + AppEmployee[i].Lastname;
                                var         appappraisal = db.Appraisal_t.Where(m => m.EmpId == Id);
                                Appraisal_t appAppr      = null;
                                if (appappraisal.Count() != 0)
                                {
                                    appAppr = appappraisal.Single();
                                    DateTime from = appAppr.From ?? DateTime.Now;
                                    DateTime to   = appAppr.To ?? DateTime.Now;
                                    row["AppPeriod"] = from.ToString("dd-MM-yyyy") + " to " + to.ToString("dd-MM-yyyy");
                                }
                                else
                                {
                                    row["AppPeriod"] = DateTime.Now.ToString("dd-MM-yyyy") + " to " + DateTime.Now.AddDays(30).ToString("dd-MM-yyyy");
                                }

                                if (appAppr == null)
                                {
                                    row["AppStatus"] = "Not Completed";
                                }
                                else if (appAppr.Status == 1)
                                {
                                    row["AppStatus"] = "partially Completed";
                                }
                                else if (appAppr.Status == 2)
                                {
                                    row["AppStatus"] = "Completed";
                                }
                                else if (appAppr.Status == 3)
                                {
                                    row["AppStatus"] = "Appraiser Review Completed";
                                }
                                else if (appAppr.Status == 4)
                                {
                                    row["AppStatus"] = "Reviewer Review Completed";
                                }

                                App_Emp.Rows.Add(row);
                                App_Emp.AcceptChanges();
                            }
                            AppGrid.DataSource = App_Emp;
                            AppGrid.DataBind();
                        }

                        var query2 = db.Employee_t.Where(m => m.Reviewer == empId);
                        List <Employee_t> RevEmployee = null;
                        DataTable         Rev_Emp     = new DataTable();
                        DataColumn        RevEmp_Id   = new DataColumn("Emp_Id", System.Type.GetType("System.Int32"));
                        Rev_Emp.Columns.Add(RevEmp_Id);
                        DataColumn RevName = new DataColumn("Name", System.Type.GetType("System.String"));
                        Rev_Emp.Columns.Add(RevName);
                        DataColumn AppPeriod2 = new DataColumn("AppPeriod", System.Type.GetType("System.String"));
                        Rev_Emp.Columns.Add(AppPeriod2);
                        DataColumn AppStatus2 = new DataColumn("AppStatus", System.Type.GetType("System.String"));
                        Rev_Emp.Columns.Add(AppStatus2);
                        if (query2.Count() != 0)
                        {
                            RevEmployee = query2.ToList();
                        }
                        else
                        {
                            tabs2.Visible = false;
                        }
                        if (RevEmployee != null)
                        {
                            for (int i = 0; i < RevEmployee.Count; i++)
                            {
                                DataRow row = Rev_Emp.NewRow();
                                int     Id  = RevEmployee[i].Emp_Id;
                                row["Emp_Id"] = RevEmployee[i].Emp_Id;
                                row["Name"]   = RevEmployee[i].Firstname + "" + RevEmployee[i].Lastname;
                                var         appappraisal1 = db.Appraisal_t.Where(m => m.EmpId == Id);
                                Appraisal_t RevAppr       = null;
                                if (appappraisal1.Count() != 0)
                                {
                                    RevAppr = appappraisal1.Single();
                                    DateTime from = RevAppr.From ?? DateTime.Now;
                                    DateTime to   = RevAppr.To ?? DateTime.Now;
                                    row["AppPeriod"] = from.ToString("dd-MM-yyyy") + " to " + to.ToString("dd-MM-yyyy");
                                }
                                else
                                {
                                    row["AppPeriod"] = DateTime.Now.ToString("dd-MM-yyyy") + " to " + DateTime.Now.AddDays(30).ToString("dd-MM-yyyy");
                                }

                                if (RevAppr == null)
                                {
                                    row["AppStatus"] = "Not Completed";
                                }
                                else if (RevAppr.Status == 1)
                                {
                                    row["AppStatus"] = "partially Completed";
                                }
                                else if (RevAppr.Status == 2)
                                {
                                    row["AppStatus"] = "Completed";
                                }
                                else if (RevAppr.Status == 3)
                                {
                                    row["AppStatus"] = "Appraiser Review Completed";
                                }
                                else if (RevAppr.Status == 4)
                                {
                                    row["AppStatus"] = "Reviewer Review Completed";
                                }
                                Rev_Emp.Rows.Add(row);
                                Rev_Emp.AcceptChanges();
                            }
                            RevGrid.DataSource = Rev_Emp;
                            RevGrid.DataBind();
                        }
                    }
                }
                else
                {
                    Response.Redirect("~/Login.aspx", false);
                }
            }
            catch (Exception ex)
            {
                using (PerformanceAppEntities db = new PerformanceAppEntities())
                {
                    Log_t log = new Log_t();
                    log.Error_Message = ex.Message;

                    log.Page     = "Dashboard";
                    log.Method   = "Page_Load";
                    log.Datetime = DateTime.Now;
                    db.Log_t.Add(log);
                    db.SaveChanges();
                    Response.Redirect("~/Login.aspx", false);
                }
            }
        }
Пример #19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                emp = Session["Employee"] as List <Employee_t>;
                Role_t role = new Role_t();
                if (emp != null)
                {
                    if (Session["Type"] != null)
                    {
                        type = Convert.ToInt32(Session["Type"].ToString());
                    }

                    if (emp[0].PwdReset == 1)
                    {
                        Response.Redirect("~/ResetPassword.aspx", false);
                    }



                    if (!Page.IsPostBack)
                    {
                        if (type == 1 || type == 2)
                        {
                            int empId = Convert.ToInt32(Request.QueryString["EmpId"].ToString());
                            using (PerformanceAppEntities db = new PerformanceAppEntities())
                            {
                                Session["Firstname"] = emp[0].Firstname;
                                Session["Lastname"]  = emp[0].Lastname;
                                //Getting the Reviewer or the appraiser object backup..
                                Session["Employee_Bckup"] = Session["Employee"];
                                emp = db.Employee_t.Where(m => m.Emp_Id == empId).ToList();
                                Session["Employee"] = emp;
                            }
                        }
                        using (PerformanceAppEntities db = new PerformanceAppEntities())
                        {
                            if (Session["Type"] != null)
                            {
                                if (type == 1)
                                {
                                    FromTextBox.Enabled    = false;
                                    ToTextBox.Enabled      = false;
                                    Responsibility.Enabled = false;
                                    Understanding.Enabled  = false;
                                }
                                else if (type == 2)
                                {
                                    FromTextBox.Enabled    = false;
                                    ToTextBox.Enabled      = false;
                                    Responsibility.Enabled = false;
                                    Understanding.Enabled  = false;
                                }
                                else if (type == 0)
                                {
                                }
                            }
                            empId = emp[0].Emp_Id;
                            var query = db.Appraisal_t.Where(m => m.EmpId == empId).ToList();
                            if (query.Count() != 0)
                            {
                                appraisal = query.Single();
                            }
                            Guid roleId = emp[0].RoleId ?? Guid.Empty;
                            role            = db.Role_t.Where(m => m.RoleId == roleId).Single();
                            Session["Role"] = role;
                            Role.Text       = role.Name;
                            if (appraisal != null)
                            {
                                Session["appraisal"] = appraisal;
                            }
                        }

                        if (appraisal != null)
                        {
                            FromTextBox.Text    = appraisal.From.Value.ToString("dd-MM-yyyy");
                            ToTextBox.Text      = appraisal.To.Value.ToString("dd-MM-yyyy");
                            Responsibility.Text = appraisal.Responsibility;
                            Understanding.Text  = appraisal.Understanding;
                        }

                        NameTextBox.Text = emp[0].Firstname + "" + emp[0].Lastname;
                        if (type == 0)
                        {
                            name.Text = emp[0].Firstname + "&nbsp;" + emp[0].Lastname;
                        }
                        else
                        {
                            name.Text = Session["Firstname"].ToString() + "&nbsp;" + Session["Lastname"].ToString();
                        }
                        DateofJoiningTextBox.Text = emp[0].Dateofjoining.Value.ToString("dd-MM-yyyy");
                        using (PerformanceAppEntities db1 = new PerformanceAppEntities())
                        {
                            if (emp[0].Appraiser != null)
                            {
                                int        appr = emp[0].Appraiser ?? 0;
                                Employee_t app  = db1.Employee_t.Where(m => m.Emp_Id == appr).Single();
                                AppraiserTextBox.Text = app.Firstname + "" + app.Lastname;
                            }
                            else
                            {
                                AppraiserTextBox.Text = "";
                            }
                            if (emp[0].Reviewer != null)
                            {
                                int        revr = emp[0].Reviewer ?? 0;
                                Employee_t rev  = db1.Employee_t.Where(m => m.Emp_Id == revr).Single();
                                ReviewerTextBox.Text = rev.Firstname + "" + rev.Lastname;
                            }
                            else
                            {
                                ReviewerTextBox.Text = "";
                            }
                        }

                        if (appraisal == null)
                        {
                            FromTextBox.Text = DateTime.Now.ToString("dd-MM-yyyy");
                            ToTextBox.Text   = DateTime.Now.AddDays(30).ToString("dd-MM-yyyy");
                        }
                    }
                }
                else
                {
                    Response.Redirect("~/Login.aspx", false);
                }
            }
            catch (Exception ex)
            {
                using (PerformanceAppEntities db = new PerformanceAppEntities())
                {
                    Log_t log = new Log_t();
                    log.Error_Message = ex.Message;

                    log.Page     = "PerformanceAppraisal";
                    log.Method   = "Page_Load";
                    log.Datetime = DateTime.Now;
                    db.Log_t.Add(log);
                    db.SaveChanges();
                    Response.Redirect("~/Login.aspx", false);
                }
            }
        }
Пример #20
0
        protected void btnSend_Click(object sender, EventArgs e)
        {
            try
            {
                using (PerformanceAppEntities db = new PerformanceAppEntities())
                {
                    var        query    = db.Employee_t.Where(m => m.Email == emailAddress.Text);
                    Employee_t employee = null;

                    if (query.Count() != 0)
                    {
                        employee          = query.Single();
                        employee.Password = RandomString(6);
                        employee.PwdReset = 1;
                        db.SaveChanges();
                        MailMessage mail        = new MailMessage();
                        var         fromAddress = "*****@*****.**"; // Gmail Address from where you send the mail
                        mail.To.Add(emailAddress.Text);
                        const string fromPassword = "******";        //Password of your gmail address
                        mail.Subject    = "Password Reset Request";
                        mail.IsBodyHtml = true;
                        mail.Body       = "<html><body><h1 align=\"left\"><img src=\"cid:image1\" /></h1><br/><h2 align=\"left\"><b>Password Reset</b></font></h2><br/>Dear " + employee.Firstname + ",<br/><br/>We received a request to reset the password associated with this e-mail address. If you made this request, then the new password is  " + employee.Password + ".<br/><br/> Click <a href=\"http://*****:*****@gmail.com");
                        AlternateView  av = AlternateView.CreateAlternateViewFromString(mail.Body, null, MediaTypeNames.Text.Html);
                        LinkedResource lr = new LinkedResource("E:\\trans.jpg", MediaTypeNames.Image.Jpeg);
                        lr.ContentId = "image1";
                        av.LinkedResources.Add(lr);
                        mail.AlternateViews.Add(av);
                        var smtp = new System.Net.Mail.SmtpClient();
                        {
                            smtp.Host           = "smtp.gmail.com";
                            smtp.Port           = 587;
                            smtp.EnableSsl      = true;
                            smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
                            smtp.Credentials    = new NetworkCredential(fromAddress, fromPassword);
                            smtp.Timeout        = 20000;
                        }
                        smtp.Send(mail);
                        lblError.Text = "Password is sent to your Email Address.";
                    }
                    else
                    {
                        lblError.Text = "Invalid Email Address";
                    }
                }
            }
            catch (Exception ex)
            {
                using (PerformanceAppEntities db = new PerformanceAppEntities())
                {
                    Log_t log = new Log_t();
                    log.Error_Message = ex.Message;

                    log.Page     = "ForgotPassword";
                    log.Method   = "btnSend_Click";
                    log.Datetime = DateTime.Now;
                    db.Log_t.Add(log);
                    db.SaveChanges();
                    Response.Redirect("~/Login.aspx", false);
                }
            }
        }
        public void Save()
        {
            try
            {
                string EmpProjectId = "";
                for (int i = 0; i < ProjectGrid.Rows.Count; i++)
                {
                    using (PerformanceAppEntities db = new PerformanceAppEntities())
                    {
                        GridViewRow  item  = ProjectGrid.Rows[i];
                        int          empId = emp[0].Emp_Id;
                        EmpProject_t pro   = new EmpProject_t();

                        var query = db.EmpProject_t.Where(m => m.EmpId == empId && m.Type == i);
                        if (query.Count() != 0)
                        {
                            pro = query.Single();
                        }

                        pro.EmpId = emp[0].Emp_Id;
                        DropDownList combo_Self = item.FindControl("SelfRating") as DropDownList;
                        pro.Self_Rating = combo_Self.SelectedValue;
                        TextBox text_Self = item.FindControl("SelfComment") as TextBox;
                        pro.SelfComments = text_Self.Text;
                        DropDownList combo_App = item.FindControl("AppraiserRating") as DropDownList;
                        pro.App_Rating = combo_App.SelectedValue;
                        TextBox text_App = item.FindControl("AppraiserComment") as TextBox;
                        pro.AppComments = text_App.Text;
                        if (query.Count() == 0)
                        {
                            pro.EmpProjId = Guid.NewGuid();
                        }
                        EmpProjectId += pro.EmpProjId.ToString() + ";";
                        pro.Type      = i;
                        if (query.Count() == 0)
                        {
                            db.EmpProject_t.Add(pro);
                        }
                        db.SaveChanges();
                    }
                }
                Session["EmpProjectId"] = EmpProjectId;

                {
                    using (PerformanceAppEntities db1 = new PerformanceAppEntities())
                    {
                        Appraisal_t appraisals = new Appraisal_t();
                        if (appraisal != null)
                        {
                            int empId = emp[0].Emp_Id;
                            appraisals = db1.Appraisal_t.Where(m => m.EmpId == empId).Single();
                        }
                        else
                        {
                            appraisals.AppId = Guid.NewGuid();
                        }
                        appraisals.EmpId       = emp[0].Emp_Id;
                        appraisals.EmpProjects = Session["EmpProjectId"] as String;
                        //appraisals.EmpSkills = Empskills;
                        //appraisals.SelfOverall = SelfAssessment0.SelectedValue;
                        //appraisals.AssessorOverAll = AssessorRating0.SelectedValue;
                        //appraisals.FinalOverAll = FinalizedRating.SelectedValue;
                        //appraisals.RecPromotion = RecommendedforPromotion0.Text;
                        //appraisals.NotPromoting = notpromoting0.Text;
                        if (appraisals.DoAssessment == null)
                        {
                            appraisals.DoAssessment = DateTime.Parse("1753-01-01 00:00:00");
                        }
                        if (appraisals.DoAssessmentDisc == null)
                        {
                            appraisals.DoAssessmentDisc = DateTime.Parse("1753-01-01 00:00:00");
                        }
                        if (appraisals.DoAssessorCompletion == null)
                        {
                            appraisals.DoAssessorCompletion = DateTime.Parse("1753-01-01 00:00:00");
                        }
                        if (appraisals.DoFinalization == null)
                        {
                            appraisals.DoFinalization = DateTime.Parse("1753-01-01 00:00:00");
                        }
                        appraisals.Understanding   = Session["Understanding"] as String;
                        appraisals.Responsibility  = Session["Responsibility"] as String;
                        appraisals.From            = Convert.ToDateTime(Session["From"] as String);
                        appraisals.To              = Convert.ToDateTime(Session["To"] as String);
                        appraisals.SkillRevRating  = ReviewerRating.SelectedValue;
                        appraisals.SkillRevComment = ReviewerComment.Text;
                        appraisals.ProAppOtherCmnt = OtherTextBox.Text;
                        if (appraisal == null)
                        {
                            db1.Appraisal_t.Add(appraisals);
                        }
                        db1.SaveChanges();
                        Session["appraisal"] = appraisals;
                    }
                }
            }
            catch (Exception ex)
            {
                using (PerformanceAppEntities db = new PerformanceAppEntities())
                {
                    Log_t log = new Log_t();
                    log.Error_Message = ex.Message;

                    log.Page     = "PerformanceAppraisal3";
                    log.Method   = "Save";
                    log.Datetime = DateTime.Now;
                    db.Log_t.Add(log);
                    db.SaveChanges();
                    Response.Redirect("~/Login.aspx", false);
                }
            }
        }