예제 #1
0
        public static void UpdatePriorityDetails(EmployeePriority empPriority)
        {
            string commandText = "UPDATE PRIORITY SET ISSUENO=@issueno, SUBJECT=@subject, STATUS=@status, COMPLETED=@completed, DEVDUEDATE=@devdue, QADUEDATE=@qadue";
            string whereClause = "";
            List <OleDbParameter> paramList = new List <OleDbParameter>();

            empPriority.IssueNumber  = (empPriority.IssueNumber == null) ? "" : empPriority.IssueNumber;
            empPriority.IssueSubject = (empPriority.IssueSubject == null) ? "" : empPriority.IssueSubject;
            empPriority.Status       = (empPriority.Status == null) ? "" : empPriority.Status;
            empPriority.Completed    = (empPriority.Completed == null) ? "0" : empPriority.Completed;
            empPriority.DevDueDate   = (empPriority.DevDueDate == null) ? "" : empPriority.DevDueDate;
            empPriority.QADueDate    = (empPriority.QADueDate == null) ? "" : empPriority.QADueDate;
            paramList.Add(new OleDbParameter("@issueno", empPriority.IssueNumber));
            paramList.Add(new OleDbParameter("@subject", empPriority.IssueSubject));
            paramList.Add(new OleDbParameter("@status", empPriority.Status));
            paramList.Add(new OleDbParameter("@completed", empPriority.Completed));
            paramList.Add(new OleDbParameter("@devdue", empPriority.DevDueDate));
            paramList.Add(new OleDbParameter("@qadue", empPriority.QADueDate));
            if (empPriority.EmployeeID != null)
            {
                whereClause += (whereClause == "") ? " WHERE EMPID=@empId" : " AND EMPID=@empId";
                paramList.Add(new OleDbParameter("@empId", empPriority.EmployeeID));
            }
            if (empPriority.Priority != null)
            {
                whereClause += (whereClause == "") ? " WHERE PRIORITY=@priority" : " AND PRIORITY=@priority";
                paramList.Add(new OleDbParameter("@priority", empPriority.Priority));
            }
            commandText += whereClause;
            DAOEmployee.ExecuteDMLCommand(commandText, paramList);
        }
예제 #2
0
        public ActionResult AssignPriority(string empId, string assignedBy, string assignTo, string pid, string status, string reason)
        {
            EmployeePriority empPriority = EmployeeDetails.ViewEmployeePriority(pid);

            EmployeeDetails.AssignEmployeePriority(assignedBy, assignTo, pid, status, reason);
            EmployeeDetails.UpdateEmployeesFollowingPriority(empPriority.EmployeeID, Convert.ToInt32(empPriority.Priority));
            return(GetEmployeePriority(empId));
        }
예제 #3
0
 public ActionResult EditPriority(EmployeePriority empPriority)
 {
     if (ModelState.IsValid)
     {
         EmployeeDetails.UpdatePriorityDetails(empPriority);
         return(RedirectToAction("DisplayPriority", new { empId = empPriority.SelectedEMPID }));
     }
     return(View(empPriority));
 }
예제 #4
0
        public ActionResult AddPriority(EmployeePriority empPriority)
        {
            if (ModelState.IsValid)
            {
                EmployeeDetails.AddPriority(empPriority);
                return(RedirectToAction("DisplayPriority", new { empId = empPriority.EmployeeID }));
            }

            return(View(empPriority));
        }
예제 #5
0
        public ActionResult ViewPriority(string empId, string PID)
        {
            EmployeePriority empPriority = EmployeeDetails.ViewEmployeePriority(PID);

            if (empPriority == null)
            {
                return(HttpNotFound());
            }
            empPriority.SelectedEMPID = empId;
            return(View(empPriority));
        }
예제 #6
0
        public ActionResult AddPriority(string empId)
        {
            DataTable dtEmployee = EmployeeDetails.GetEmployees(empId);

            if (dtEmployee.Rows.Count == 0)
            {
                return(HttpNotFound());
            }
            EmployeePriority empPriority = new EmployeePriority();

            empPriority.EmployeeID   = empId;
            empPriority.EmployeeName = dtEmployee.Rows[0]["EMPNAME"].ToString();
            string maxPriority = EmployeeDetails.GetEmployeeMaxPriority(empId);

            empPriority.Priority = ((maxPriority == "") ? 1 : Convert.ToInt32(maxPriority) + 1).ToString();
            return(View(empPriority));
        }
예제 #7
0
        /*public static EmployeePriority EditEmployeePriority(string PID)
         * {
         *  EmployeePriority empPriority = null;
         *  DataTable dtPriority = GetEmployeePriorityById(PID);
         *  if (dtPriority.Rows.Count > 0)
         *  {
         *      empPriority = new EmployeePriority();
         *      empPriority.EmployeeID = dtPriority.Rows[0]["EMPID"].ToString(); ;
         *      empPriority.EmployeeName = dtPriority.Rows[0]["EMPNAME"].ToString();
         *      empPriority.IssueNumber = dtPriority.Rows[0]["ISSUENO"].ToString();
         *      empPriority.IssueSubject = dtPriority.Rows[0]["SUBJECT"].ToString();
         *      empPriority.DevDueDate = dtPriority.Rows[0]["DEVDUEDATE"].ToString().Split(' ')[0];
         *      empPriority.QADueDate = dtPriority.Rows[0]["QADUEDATE"].ToString().Split(' ')[0];
         *      empPriority.Priority = dtPriority.Rows[0]["PRIORITY"].ToString();
         *  }
         *  return empPriority;
         * }*/

        public static void AddPriority(EmployeePriority empPriority)
        {
            string commandText = "INSERT INTO PRIORITY(EMPID,ISSUENO,SUBJECT,STATUS,COMPLETED,DEVDUEDATE,QADUEDATE,PRIORITY,ENTEREDBY,ASSIGNEDBY) VALUES(@empId,@issueno,@subject,@status,@completed,@devdue,@qadue,@priority,@enteredby,@assignedby)";
            List <OleDbParameter> paramList = new List <OleDbParameter>();

            empPriority.Completed  = (empPriority.Completed == null) ? "0" : empPriority.Completed;
            empPriority.DevDueDate = (empPriority.DevDueDate == null) ? "" : empPriority.DevDueDate;
            empPriority.QADueDate  = (empPriority.QADueDate == null) ? "" : empPriority.QADueDate;
            paramList.Add(new OleDbParameter("@empId", empPriority.EmployeeID));
            paramList.Add(new OleDbParameter("@issueno", empPriority.IssueNumber));
            paramList.Add(new OleDbParameter("@subject", empPriority.IssueSubject));
            paramList.Add(new OleDbParameter("@status", empPriority.Status));
            paramList.Add(new OleDbParameter("@completed", empPriority.Completed));
            paramList.Add(new OleDbParameter("@devdue", empPriority.DevDueDate));
            paramList.Add(new OleDbParameter("@qadue", empPriority.QADueDate));
            paramList.Add(new OleDbParameter("@priority", empPriority.Priority));
            paramList.Add(new OleDbParameter("@enteredby", empPriority.EnteredBy));
            paramList.Add(new OleDbParameter("@assignedby", empPriority.AssignedBy));
            DAOEmployee.ExecuteDMLCommand(commandText, paramList);
        }
예제 #8
0
        //
        // GET: /DisplayPriority/

        public ActionResult DisplayPriority(string empId)
        {
            EmployeePriority empPriority = new EmployeePriority();

            empPriority.lstEmployees = new List <SelectListItem>();
            DataTable dtEmployee       = EmployeeDetails.GetEmployees(null);
            bool      bIsValidEmployee = false;

            foreach (DataRow drEmp in dtEmployee.Rows)
            {
                empPriority.lstEmployees.Add(new SelectListItem {
                    Text = drEmp["EMPNAME"].ToString(), Value = drEmp["EMPID"].ToString()
                });
                if ((empId != null) && (empId == drEmp["EMPID"].ToString()))
                {
                    bIsValidEmployee = true;
                }
            }

            if (empPriority.lstEmployees.Count > 0)
            {
                empPriority.lstEmployees.Add(new SelectListItem {
                    Text = "All Employees", Value = "-1"
                });
            }

            if ((empId == null) || ((empId != null) && (empPriority.lstEmployees.Count > 0) && (empId == "-1")))
            {
                bIsValidEmployee = true;
            }

            if (!bIsValidEmployee)
            {
                return(RedirectToAction("ErrorMessage", "Error", new { message = "Employee Id is not valid!" }));
            }

            empPriority.SelectedEMPID = empId;
            return(View(empPriority));
        }
예제 #9
0
        public static EmployeePriority ViewEmployeePriority(string PID)
        {
            EmployeePriority empPriority = null;
            DataTable        dtPriority  = GetEmployeePriorityById(PID);

            if (dtPriority.Rows.Count > 0)
            {
                empPriority              = new EmployeePriority();
                empPriority.EmployeeID   = dtPriority.Rows[0]["EMPID"].ToString();;
                empPriority.EmployeeName = dtPriority.Rows[0]["EMPNAME"].ToString();
                empPriority.IssueNumber  = dtPriority.Rows[0]["ISSUENO"].ToString();
                empPriority.IssueSubject = dtPriority.Rows[0]["SUBJECT"].ToString();
                empPriority.Status       = dtPriority.Rows[0]["STATUS"].ToString();
                empPriority.Completed    = dtPriority.Rows[0]["COMPLETED"].ToString();
                empPriority.DevDueDate   = dtPriority.Rows[0]["DEVDUEDATE"].ToString().Split(' ')[0];
                empPriority.QADueDate    = dtPriority.Rows[0]["QADUEDATE"].ToString().Split(' ')[0];
                empPriority.Priority     = dtPriority.Rows[0]["PRIORITY"].ToString();
                empPriority.Reason       = dtPriority.Rows[0]["REASON"].ToString();
                empPriority.EnteredBy    = GetEmployeeName(dtPriority.Rows[0]["ENTEREDBY"].ToString());
                empPriority.AssignedBy   = GetEmployeeName(dtPriority.Rows[0]["ASSIGNEDBY"].ToString());
            }
            return(empPriority);
        }
예제 #10
0
        public static bool UploadPriorityFile(HttpPostedFileBase file, string empId, ref string message, ref string summary, ref List <UploadSummaryReport> uploadSummaryReport)
        {
            uploadSummaryReport = new List <UploadSummaryReport>();
            bool   bUpload             = true;
            string missingFieldMessage = "Required Field(s) Missing : ";
            string invalidFieldMessage = "Invalid Input(s) : ";
            string rowmessage          = "";
            string missingFieldList    = "";
            string invalidFieldList    = "";
            bool   bValidRow           = true;
            int    recordRow           = 0;

            try
            {
                using (StreamReader reader = new StreamReader(file.InputStream))
                {
                    while (true)
                    {
                        missingFieldList = "";
                        invalidFieldList = "";
                        rowmessage       = "";
                        bValidRow        = true;
                        string line = reader.ReadLine();
                        if (line == null)
                        {
                            break;
                        }
                        else if (line.Trim() == "")
                        {
                            continue;
                        }
                        else
                        {
                            UploadSummaryReport report = new UploadSummaryReport();
                            recordRow++;
                            string[]         row         = line.Trim().Split(',');
                            EmployeePriority empPriority = new EmployeePriority();
                            if ((row.Length >= 1) && (row[0].ToString() != ""))
                            {
                                empPriority.EmployeeID = row[0].ToString();
                                if (GetEmployeeName(empPriority.EmployeeID) == "")
                                {
                                    bValidRow         = false;
                                    invalidFieldList += (invalidFieldList != "")? ", " : "";
                                    invalidFieldList += "Employee ID";
                                }
                            }
                            else
                            {
                                //required
                                bValidRow         = false;
                                missingFieldList += (missingFieldList != "") ? ", " : "";
                                missingFieldList += "Employee ID";
                            }
                            if ((row.Length >= 2) && (row[1].ToString() != ""))
                            {
                                empPriority.IssueNumber = row[1].ToString();
                            }
                            else
                            {
                                //required
                                bValidRow         = false;
                                missingFieldList += (missingFieldList != "") ? ", " : "";
                                missingFieldList += "Issue Number";
                            }
                            if ((row.Length >= 3) && (row[2].ToString() != ""))
                            {
                                empPriority.IssueSubject = row[2].ToString();
                            }
                            else
                            {
                                //required
                                bValidRow         = false;
                                missingFieldList += (missingFieldList != "") ? ", " : "";
                                missingFieldList += "Issue Subject";
                            }
                            if ((row.Length >= 4) && (row[3].ToString() != ""))
                            {
                                empPriority.Status = row[3].ToString();
                            }
                            else
                            {
                                //required
                                bValidRow         = false;
                                missingFieldList += (missingFieldList != "") ? ", " : "";
                                missingFieldList += "Issue Status";
                            }
                            if ((row.Length >= 5) && (row[4] != ""))
                            {
                                empPriority.Completed = row[4].ToString();
                                int completed;
                                if (Int32.TryParse(empPriority.Completed, out completed))
                                {
                                    if ((completed < 0) || (completed > 100))
                                    {
                                        //invalid
                                        bValidRow         = false;
                                        invalidFieldList += (invalidFieldList != "") ? ", " : "";
                                        invalidFieldList += "% Completed(must be between 0 and 100)";
                                    }
                                }
                                else
                                {
                                    //invalid
                                    bValidRow         = false;
                                    invalidFieldList += (invalidFieldList != "") ? ", " : "";
                                    invalidFieldList += "% Completed(must be an integer)";
                                }
                            }
                            else
                            {
                                empPriority.Completed = "0";
                            }
                            if (row.Length >= 6)
                            {
                                empPriority.DevDueDate = row[5].ToString();
                                DateTime devdue;
                                string   format = "MM/dd/yyyy";
                                if (!DateTime.TryParseExact(empPriority.DevDueDate, format, CultureInfo.InvariantCulture, DateTimeStyles.None, out devdue))
                                {
                                    //invalid
                                    bValidRow         = false;
                                    invalidFieldList += (invalidFieldList != "") ? ", " : "";
                                    invalidFieldList += "Dev Due Date(must be in MM/DD/YYYY format)";
                                }
                            }
                            else
                            {
                                empPriority.DevDueDate = "";
                            }
                            if (row.Length >= 7)
                            {
                                empPriority.QADueDate = row[6].ToString();
                                DateTime qadue;
                                string   format = "MM/dd/yyyy";
                                if (!DateTime.TryParseExact(empPriority.QADueDate, format, CultureInfo.InvariantCulture, DateTimeStyles.None, out qadue))
                                {
                                    //invalid
                                    bValidRow         = false;
                                    invalidFieldList += (invalidFieldList != "") ? ", " : "";
                                    invalidFieldList += "QA Due Date(must be in MM/DD/YYYY format)";
                                }
                            }
                            else
                            {
                                empPriority.QADueDate = "";
                            }
                            if (bValidRow)
                            {
                                string maxPriority = GetEmployeeMaxPriority(empPriority.EmployeeID);
                                empPriority.Priority   = ((maxPriority == "") ? 1 : Convert.ToInt32(maxPriority) + 1).ToString();
                                empPriority.EnteredBy  = empId;
                                empPriority.AssignedBy = empId;
                                AddPriority(empPriority);
                                rowmessage = "Inserted Successfully.";
                            }
                            else
                            {
                                int errorCount = 0;
                                if (missingFieldList != "")
                                {
                                    errorCount++;
                                    rowmessage += (rowmessage == "") ? "Error(s) : " : " ";
                                    rowmessage += errorCount + ". " + missingFieldMessage + missingFieldList;
                                }
                                if (invalidFieldList != "")
                                {
                                    errorCount++;
                                    rowmessage += (rowmessage == "") ? "Error(s) : " : " ";
                                    rowmessage += errorCount + ". " + invalidFieldMessage + invalidFieldList;
                                }
                            }
                            report.RecordNo = recordRow;
                            report.Message  = rowmessage;
                            report.Status   = (bValidRow == true) ? "PASS" : "FAIL";
                            uploadSummaryReport.Add(report);
                            //rowmessage = "Record " + recordRow + ". " + rowmessage;
                            //summary += (summary != "") ? ("<br/>" + rowmessage) : rowmessage;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                bUpload             = false;
                uploadSummaryReport = null;
                message             = e.Message;
            }
            return(bUpload);
        }