Example #1
0
        public Info insert_reviewerdata(WorkMaint data)
        {
            //This will be called when reviewer clicked on the Review button in the work items grid. so we are not displaying any message.
            Info       retVal = new Info("", false);
            SqlCommand cmd    = null;

            try
            {
                using (con = new SqlConnection(conStr))
                {
                    con.Open();
                    using (cmd = new SqlCommand(StaticData.CREATE_REVIEWER_WORKMAINTENANCE, con))
                    {
                        cmd.CommandType = System.Data.CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@workitemid", data.WorkItemId);
                        cmd.Parameters.AddWithValue("@userid", Common.GetUser.UserId);
                        cmd.Parameters.AddWithValue("@starteddate", DateTime.Now);
                        cmd.Parameters.AddWithValue("@itemstatus", data.Status);
                        cmd.Parameters.AddWithValue("@usertype", "Reviewer"); //Hard coding this because this will be used only by the reviewer.
                        cmd.ExecuteNonQuery();
                        retVal._success = true;
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Log(Logger.LogType.Error, ex.ToString());
            }
            return(retVal);
        }
Example #2
0
        public WMViewModel GetWorkMaintData(String status = "")
        {
            WMViewModel      workms = new WMViewModel("", false);
            List <WorkMaint> wm     = new List <WorkMaint>();

            String     sqlCmd = StaticData.GET_WORKMAINTS;
            SqlCommand cmd    = null;

            try
            {
                using (con = new SqlConnection(conStr))
                {
                    con.Open();
                    using (cmd = new SqlCommand(sqlCmd, con))
                    {
                        cmd.CommandType = System.Data.CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@CreatedBy", Common.GetUser.UserId);
                        if (!String.IsNullOrEmpty(status))
                        {
                            cmd.Parameters.AddWithValue("@Status", status);
                        }

                        SqlDataReader rdr = cmd.ExecuteReader();
                        while (rdr.Read())
                        {
                            WorkMaint e = new WorkMaint();
                            e.WorkItemId       = Convert.ToInt32(rdr["workitemid"]);
                            e.ActivityId       = Convert.ToInt32(rdr["activityid"]);
                            e.InvoiceNumber    = Convert.ToString(rdr["invoice_number"]);
                            e.ActivityName     = Convert.ToString(rdr["activityname"]);
                            e.RequestNumber    = Convert.ToString(rdr["request_number"]);
                            e.Comments         = Convert.ToString(rdr["comments"]);
                            e.UserId           = Convert.ToString(rdr["userid"]);
                            e.StartedDate      = Convert.ToDateTime(rdr["starteddate"]);
                            e.Status           = Convert.ToString(rdr["itemstatus"]);
                            e.ReviewerComments = Convert.ToString(rdr["reviewercomments"]);
                            e.ReviewerName     = Convert.ToString(rdr["reviewername"]);
                            wm.Add(e);
                        }
                        workms._success      = true;
                        workms.WorkMaintList = wm;
                        CloseReader(rdr);
                    }
                }
            }
            catch (Exception ex)
            {
                workms._message = FinTrackRes.WM_RETRIEVE_ERR;
                Logger.Log(Logger.LogType.Error, ex.ToString());
            }
            return(workms);
        }
Example #3
0
        public WMUpdateViewModel update_reviewerdata(WorkMaint data)
        {
            WMUpdateViewModel retVal = new WMUpdateViewModel(FinTrackRes.WM_UPDATE_ERR, false);
            SqlCommand        cmd    = null;

            try
            {
                using (con = new SqlConnection(conStr))
                {
                    con.Open();
                    using (cmd = new SqlCommand(StaticData.UPDATE_REVIEWER_WORKMAINTENANCE, con))
                    {
                        cmd.CommandType = System.Data.CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@workitemid", data.WorkItemId);
                        cmd.Parameters.AddWithValue("@userid", Common.GetUser.UserId);
                        cmd.Parameters.AddWithValue("@revcomments", data.ReviewerComments);
                        cmd.Parameters.AddWithValue("@starteddate", DateTime.Now);
                        cmd.Parameters.AddWithValue("@itemstatus", data.Status);
                        cmd.Parameters.AddWithValue("@usertype", "Reviewer"); //Hard coding this because this will be used only by the reviewer.
                        cmd.Parameters.AddWithValue("@iserrorfound", data.ErrFound);
                        SqlDataReader rdr = cmd.ExecuteReader();

                        if (rdr.Read())
                        {
                            retVal.WMCnt      = Convert.ToInt32(rdr["wmcnt"]);
                            retVal.RevieweeId = Convert.ToString(rdr["RevieweeId"]);
                        }

                        retVal._success = true;

                        if (data.Status == "Rework")//Rework then display the message.
                        {
                            retVal._message = FinTrackRes.WM_UPDATE_REW;
                        }
                        else
                        {
                            retVal._message = FinTrackRes.WM_UPDATE_APPR_ERR_FIND;
                        }

                        CloseReader(rdr);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Log(Logger.LogType.Error, ex.ToString());
            }
            return(retVal);
        }
Example #4
0
        public WMUpdateViewModel update(WorkMaint data)
        {
            WMUpdateViewModel retVal = new WMUpdateViewModel(FinTrackRes.WM_UPDATE_ERR, false);
            SqlCommand        cmd    = null;

            try
            {
                using (con = new SqlConnection(conStr))
                {
                    con.Open();
                    using (cmd = new SqlCommand(StaticData.UPDATE_WORKMAINTENANCE, con))
                    {
                        cmd.CommandType = System.Data.CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@workitemid", data.WorkItemId);
                        cmd.Parameters.AddWithValue("@userid", Common.GetUser.UserId);
                        cmd.Parameters.AddWithValue("@comments", data.Comments);
                        cmd.Parameters.AddWithValue("@starteddate", DateTime.Now);
                        cmd.Parameters.AddWithValue("@itemstatus", data.Status);
                        cmd.Parameters.AddWithValue("@usertype", "Processor");
                        cmd.Parameters.AddWithValue("@invoicenumber", data.InvoiceNumber);
                        cmd.Parameters.AddWithValue("@requestnumber", data.RequestNumber);
                        SqlDataReader rdr = cmd.ExecuteReader();

                        if (rdr.Read())
                        {
                            retVal.WMCnt = Convert.ToInt32(rdr["revcnt"]);
                        }

                        retVal._success = true;
                        if (data.Status.Contains("Submitted"))
                        {
                            retVal._message = FinTrackRes.WM_UPDATE;
                        }
                        else
                        {
                            retVal._message = String.Empty;
                        }

                        CloseReader(rdr);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Log(Logger.LogType.Error, ex.ToString());
            }
            return(retVal);
        }
Example #5
0
        public Info save(WorkMaint data)
        {
            SqlCommand cmd = null; String team = data.Team;

            if (String.IsNullOrEmpty(data.Team))
            {
                team = Common.GetUser.AssignedTeam;
            }
            Info retVal = new Info(FinTrackRes.WM_SAVE_ERR, false);

            try
            {
                using (con = new SqlConnection(conStr))
                {
                    con.Open();
                    using (cmd = new SqlCommand(StaticData.CREATE_WORKMAINTENANCE, con))
                    {
                        cmd.CommandType = System.Data.CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@activityid", data.ActivityId);
                        cmd.Parameters.AddWithValue("@invoicenum", data.InvoiceNumber);
                        cmd.Parameters.AddWithValue("@requestnum", data.RequestNumber);
                        cmd.Parameters.AddWithValue("@comments", data.Comments);
                        cmd.Parameters.AddWithValue("@userid", Common.GetUser.UserId);
                        cmd.Parameters.AddWithValue("@starteddate", DateTime.Now);
                        cmd.Parameters.AddWithValue("@itemstatus", "Created");
                        cmd.Parameters.AddWithValue("@team", team);
                        cmd.ExecuteNonQuery();
                        retVal._message = FinTrackRes.WM_SAVE;
                        retVal._success = true;
                    }
                }
            }
            catch (SqlException ex)
            {
                retVal._message = ex.Message;
                retVal._success = false;
            }
            catch (Exception ex)
            {
                Logger.Log(Logger.LogType.Error, ex.ToString());
            }
            return(retVal);
        }
Example #6
0
        public WMViewModel getPendingList(FilterAndPagerInfo filterInfo)
        {
            WMViewModel workms = new WMViewModel("", false);

            workms.Activities = new ActivityList();
            List <WorkMaint>  wm  = new List <WorkMaint>();
            List <Activities> act = new List <Activities>();

            SqlCommand cmd    = null;
            String     sqlCmd = StaticData.GET_WORKMAINT_PENDING_REVIEW;

            try
            {
                using (con = new SqlConnection(conStr))
                {
                    con.Open();
                    using (cmd = new SqlCommand(sqlCmd, con))
                    {
                        SqlParameter totalRows = new SqlParameter("@TotalRows", System.Data.SqlDbType.Int);
                        totalRows.Direction = System.Data.ParameterDirection.Output;

                        cmd.CommandType = System.Data.CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@CreatedBy", Common.GetUser.UserId);
                        if (filterInfo.Filters != null)
                        {
                            foreach (Filter key in filterInfo.Filters)
                            {
                                if (key != null && key.Key != null)
                                {
                                    cmd.Parameters.AddWithValue("@" + key.Key, key.Value);
                                }
                            }
                        }
                        cmd.Parameters.AddWithValue("@PageIndex", filterInfo.PageIndex);
                        cmd.Parameters.AddWithValue("@PageSize", filterInfo.PageSize);
                        cmd.Parameters.Add(totalRows);

                        SqlDataReader rdr = cmd.ExecuteReader();
                        while (rdr.Read())
                        {
                            WorkMaint e = new WorkMaint();
                            e.WorkItemId    = Convert.ToInt32(rdr["workitemid"]);
                            e.ActivityId    = Convert.ToInt32(rdr["activityid"]);
                            e.InvoiceNumber = Convert.ToString(rdr["invoice_number"]);
                            e.ActivityName  = Convert.ToString(rdr["activityname"]);
                            e.RequestNumber = Convert.ToString(rdr["request_number"]);
                            e.Comments      = Convert.ToString(rdr["comments"]);
                            e.UserId        = Convert.ToString(rdr["userid"]);
                            e.StartedDate   = Convert.ToDateTime(rdr["starteddate"]);
                            e.Status        = Convert.ToString(rdr["itemstatus"]);
                            wm.Add(e);
                        }
                        workms.WorkMaintList = wm;
                        rdr.NextResult();
                        workms.TotalRows = Convert.ToInt32(totalRows.Value);

                        CloseReader(rdr);
                        workms._success = true;
                    }
                }
            }
            catch (Exception ex)
            {
                workms._message = FinTrackRes.WM_RETRIEVE_ERR;
                Logger.Log(Logger.LogType.Error, ex.ToString());
            }
            return(workms);
        }
Example #7
0
        public WMViewModel getList()
        {
            WMViewModel workms = new WMViewModel("", false);

            workms.Activities = new ActivityList();
            List <WorkMaint>  wm  = new List <WorkMaint>();
            List <Activities> act = new List <Activities>();

            String     sqlCmd = String.Empty;
            SqlCommand cmd    = null;

            try
            {
                using (con = new SqlConnection(conStr))
                {
                    con.Open();

                    //Check the reviewer is logged in or the user is logged in. based on this we need to generate the list
                    //if (Common.GetUser.IsNormalUser)
                    sqlCmd = StaticData.GET_WORKMAINT_PENDING_SUBMIT;
                    //else sqlCmd = StaticData.GET_WORKMAINT_PENDING_REVIEW;
                    using (cmd = new SqlCommand(sqlCmd, con))
                    {
                        cmd.CommandType = System.Data.CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@CreatedBy", Common.GetUser.UserId);
                        cmd.Parameters.AddWithValue("@Team", String.IsNullOrEmpty(Team)? Common.GetUser.AssignedTeam : Team);
                        SqlDataReader rdr = cmd.ExecuteReader();
                        while (rdr.Read())
                        {
                            WorkMaint e = new WorkMaint();
                            e.WorkItemId    = Convert.ToInt32(rdr["workitemid"]);
                            e.ActivityId    = Convert.ToInt32(rdr["activityid"]);
                            e.InvoiceNumber = Convert.ToString(rdr["invoice_number"]);
                            e.ActivityName  = Convert.ToString(rdr["activityname"]);
                            e.RequestNumber = Convert.ToString(rdr["request_number"]);
                            e.Comments      = Convert.ToString(rdr["comments"]);
                            e.UserId        = Convert.ToString(rdr["userid"]);
                            e.StartedDate   = Convert.ToDateTime(rdr["starteddate"]);
                            e.Status        = Convert.ToString(rdr["itemstatus"]);
                            wm.Add(e);
                        }
                        workms.WorkMaintList = wm;
                        rdr.NextResult();
                        while (rdr.Read())
                        {
                            Activities a = new Activities();
                            a.activityid  = Convert.ToInt32(rdr["activityid"]);
                            a.description = Convert.ToString(rdr["description"]);
                            act.Add(a);
                        }
                        workms.Activities.lst = act;

                        CloseReader(rdr);
                        workms._success = true;
                    }
                }
            }
            catch (Exception ex)
            {
                workms._message = FinTrackRes.WM_RETRIEVE_ERR;
                Logger.Log(Logger.LogType.Error, ex.ToString());
            }
            return(workms);
        }