Exemplo n.º 1
0
        public ResultResponse UpdateOrApproveCapex(CapexInformationMaster capexmaster, int userId)
        {
            try
            {
                accessManager.SqlConnectionOpen(DataBase.SQQeye);
                List <SqlParameter> aParameters = new List <SqlParameter>();
                aParameters.Add(new SqlParameter("@capexInfoId", capexmaster.CapexInfoId));
                aParameters.Add(new SqlParameter("@userId", userId));
                aParameters.Add(new SqlParameter("@isApproved", capexmaster.IsApproved));
                aParameters.Add(new SqlParameter("@reviewComment", capexmaster.CapexReview));

                ResultResponse result = new ResultResponse();
                result.isSuccess = accessManager.UpdateData("sp_UpdateApproveRequest", aParameters);
                return(result);
            }
            catch (Exception e)
            {
                accessManager.SqlConnectionClose(true);
                throw;
            }
            finally
            {
                accessManager.SqlConnectionClose();
            }
        }
        public ActionResult ShowPertialviewModal(CapexInformationMaster capexInformationMaster)
        {
            int userID = Convert.ToInt32(Session["SQuserId"].ToString());

            capexInformationMaster.CapexFileUpload = new List <CapexFileUploadDetails>();
            capexInformationMaster.CapexFileUpload = capexApproval.GetUploadedFilesByID(0, userID);
            return(PartialView("_modalShowCapexinfo", capexInformationMaster));
        }
        public ActionResult UpdatedCapexInfo(CapexInformationMaster capexInformationMaster)
        {
            ResultResponse result = new ResultResponse();
            int            userID = Convert.ToInt32(Session["SQuserId"].ToString());

            result = capexApproval.UpdateOrApproveCapex(capexInformationMaster, userID);
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        public ResultResponse SaveCapexInformationDatabase(CapexInformationMaster capexmaster, int userId)
        {
            try
            {
                int masterId = 0;
                accessManager.SqlConnectionOpen(DataBase.SQQeye);
                List <SqlParameter> aParameters = new List <SqlParameter>();
                aParameters.Add(new SqlParameter("@CapexName", capexmaster.CapexName));
                aParameters.Add(new SqlParameter("@BusinessUnitId", capexmaster.BusinessUnitId));
                aParameters.Add(new SqlParameter("@CapexCatagoryID", capexmaster.CapexCatagoryID));
                aParameters.Add(new SqlParameter("@CapexAssetType", capexmaster.CapexAssetType));
                aParameters.Add(new SqlParameter("@CapexCreateDate", capexmaster.CapexCreateDate));
                aParameters.Add(new SqlParameter("@CapexDescription", capexmaster.CapexDescription));
                aParameters.Add(new SqlParameter("@capexLocationId", capexmaster.LocationId));
                aParameters.Add(new SqlParameter("@Currency", capexmaster.CurrencyID));
                aParameters.Add(new SqlParameter("@UserID", userId));

                masterId = accessManager.SaveDataReturnPrimaryKey("sp_SaveCapexMasterInfo", aParameters);
                ResultResponse result = new ResultResponse();
                result.pk        = masterId;
                result.isSuccess = true;
                foreach (CapexInformationDetails item in capexmaster.CapexInformationDetails)
                {
                    List <SqlParameter> aList = new List <SqlParameter>();
                    aList.Add(new SqlParameter("@CapexInfoDetailsId", '0'));
                    aList.Add(new SqlParameter("@CapexAssetCatagory", item.CapexAssetCatagory));
                    aList.Add(new SqlParameter("@CapexAssetDescription", item.CapexAssetDescription));
                    aList.Add(new SqlParameter("@CapexDetailsQty", item.CapexDetailsQty));
                    aList.Add(new SqlParameter("@CapexUnitPrice", item.CapexUnitPrice));
                    aList.Add(new SqlParameter("@CapexEstimatedCost", item.CapexEstimatedCost));
                    aList.Add(new SqlParameter("@CurrencyID", capexmaster.CurrencyID));
                    aList.Add(new SqlParameter("@CapexInfoId", masterId));
                    result.isSuccess = accessManager.SaveData("sp_SaveCapexDetails", aList);
                }
                // bool xres = FileUploadToDatabase(capexmaster.CapexFileUpload, masterId);

                return(result);
            }
            catch (Exception e)
            {
                accessManager.SqlConnectionClose(true);
                throw;
            }
            finally
            {
                accessManager.SqlConnectionClose();
            }
        }
Exemplo n.º 5
0
        public ResultResponse RevisedCapexInformation(CapexInformationMaster capexmaster, int userId)
        {
            ResultResponse result = new ResultResponse();

            try
            {
                int masterId = 0;
                accessManager.SqlConnectionOpen(DataBase.SQQeye);
                List <SqlParameter> aParameters = new List <SqlParameter>();
                aParameters.Add(new SqlParameter("@CapexDescription", capexmaster.CapexDescription));
                aParameters.Add(new SqlParameter("@capexInfo", capexmaster.CapexInfoId));
                aParameters.Add(new SqlParameter("@UserID", userId));

                result.isSuccess = accessManager.UpdateData("sp_updateCapexInfoMaster", aParameters);
                foreach (CapexInformationDetails item in capexmaster.CapexInformationDetails)
                {
                    List <SqlParameter> aList = new List <SqlParameter>();
                    aList.Add(new SqlParameter("@CapexInfoDetailsId", item.CapexInfoDetailsId));
                    aList.Add(new SqlParameter("@CapexAssetCatagory", item.CapexAssetCatagory));
                    aList.Add(new SqlParameter("@CapexAssetDescription", item.CapexAssetDescription));
                    aList.Add(new SqlParameter("@CapexDetailsQty", item.CapexDetailsQty));
                    aList.Add(new SqlParameter("@CapexUnitPrice", item.CapexUnitPrice));
                    aList.Add(new SqlParameter("@CapexEstimatedCost", item.CapexEstimatedCost));
                    aList.Add(new SqlParameter("@CurrencyID", 1));
                    aList.Add(new SqlParameter("@CapexInfoId", capexmaster.CapexInfoId));
                    result.isSuccess = accessManager.SaveData("sp_SaveCapexDetails", aList);
                }
                return(result);
            }
            catch (Exception e)
            {
                accessManager.SqlConnectionClose(true);
                throw;
            }
            finally
            {
                accessManager.SqlConnectionClose();
            }
        }
Exemplo n.º 6
0
        public List <CapexInformationMaster> GetALLCapexInfo(int bunit, int catid, string startdate, string enddate)
        {
            List <CapexInformationMaster> capexInformationMaster = new List <CapexInformationMaster>();

            try
            {
                accessManager.SqlConnectionOpen(DataBase.SQQeye);
                List <SqlParameter> aList = new List <SqlParameter>();
                aList.Add(new SqlParameter("@businessId", bunit));
                aList.Add(new SqlParameter("@catagoryId", catid));
                aList.Add(new SqlParameter("@startDate", startdate));
                aList.Add(new SqlParameter("@enddate", enddate));
                SqlDataReader dr = accessManager.GetSqlDataReader("sp_GetCatagorizedCapexInformation", aList);
                while (dr.Read())
                {
                    CapexInformationMaster capexInformation = new CapexInformationMaster();
                    capexInformation.CapexInfoId       = (int)dr["CapexInfoId"];
                    capexInformation.CapexName         = dr["CapexName"].ToString();
                    capexInformation.CapexCreateDate   = (DateTime)dr["CapexCreateDate"];
                    capexInformation.BusinessUnitName  = dr["BusinessUnitName"].ToString();
                    capexInformation.CapexCatagoryName = dr["CapexCatagoryName"].ToString();
                    capexInformation.UserName          = dr["UserName"].ToString();
                    capexInformation.Cost = (double)dr["TotalCost"];
                    capexInformationMaster.Add(capexInformation);
                }
                return(capexInformationMaster);
            }
            catch (Exception e)
            {
                accessManager.SqlConnectionClose(true);
                throw e;
            }
            finally
            {
                accessManager.SqlConnectionClose();
            }
        }
Exemplo n.º 7
0
        public List <CapexInformationMaster> GetCapexInfo(int UserId, int status)
        {
            List <CapexInformationMaster> capexInformationMaster = new List <CapexInformationMaster>();

            try
            {
                accessManager.SqlConnectionOpen(DataBase.SQQeye);
                List <SqlParameter> aList = new List <SqlParameter>();
                aList.Add(new SqlParameter("@userId", UserId));
                aList.Add(new SqlParameter("@status", status));
                SqlDataReader dr = accessManager.GetSqlDataReader("sp_GetALLPendingCapex", aList);
                while (dr.Read())
                {
                    CapexInformationMaster capexInformation = new CapexInformationMaster();
                    capexInformation.CapexInfoId       = (int)dr["CapexInfoId"];
                    capexInformation.CapexName         = dr["CapexName"].ToString();
                    capexInformation.CapexAssetType    = dr["CapexAssetType"].ToString();
                    capexInformation.CapexCreateDate   = (DateTime)dr["CapexCreateDate"];
                    capexInformation.BusinessUnitName  = dr["BusinessUnitName"].ToString();
                    capexInformation.CapexCatagoryName = dr["CapexCatagoryName"].ToString();
                    capexInformation.UserName          = dr["UserName"].ToString();
                    capexInformation.IsApproved        = (int)dr["IsApproved"];
                    capexInformationMaster.Add(capexInformation);
                }
                return(capexInformationMaster);
            }
            catch (Exception e)
            {
                accessManager.SqlConnectionClose(true);
                throw;
            }
            finally
            {
                accessManager.SqlConnectionClose();
            }
        }
Exemplo n.º 8
0
        public CapexInformationMaster GetSavedCapex(int userId, int capexInfoId)
        {
            CapexInformationMaster capexInformationMaster = new CapexInformationMaster();

            try
            {
                accessManager.SqlConnectionOpen(DataBase.SQQeye);
                List <SqlParameter> aList = new List <SqlParameter>();
                aList.Add(new SqlParameter("@capexId", capexInfoId));
                SqlDataReader dr = accessManager.GetSqlDataReader("sp_GetSavedCapex", aList);
                while (dr.Read())
                {
                    capexInformationMaster.CapexInfoId       = (int)dr["CapexInfoId"];
                    capexInformationMaster.CapexName         = dr["CapexName"].ToString();
                    capexInformationMaster.CapexAssetType    = dr["CapexAssetType"].ToString();
                    capexInformationMaster.CapexCreateDate   = (DateTime)dr["CapexCreateDate"];
                    capexInformationMaster.CapexDescription  = dr["CapexDescription"].ToString();
                    capexInformationMaster.BusinessUnitName  = dr["BusinessUnitName"].ToString();
                    capexInformationMaster.CapexCatagoryName = dr["CapexCatagoryName"].ToString();
                    capexInformationMaster.Currency          = dr["CurrencyName"].ToString();
                    capexInformationMaster.UserName          = dr["UserName"].ToString();
                    capexInformationMaster.UserId            = (int)dr["UserId"];
                    capexInformationMaster.Revision          = (int)dr["Revision"];
                }
                dr.Close();
                capexInformationMaster.CapexInformationDetails = new List <CapexInformationDetails>();
                dr = accessManager.GetSqlDataReader("sp_GetDetailsSavedCapex", aList);
                while (dr.Read())
                {
                    CapexInformationDetails capexInformation = new CapexInformationDetails();
                    capexInformation.CapexInfoDetailsId    = (int)dr["CapexInfoDetailsId"];
                    capexInformation.CapexAssetCatagory    = dr["CapexAssetCatagory"].ToString();
                    capexInformation.CapexAssetDescription = dr["CapexAssetDescription"].ToString();
                    capexInformation.CapexDetailsQty       = float.Parse(dr["CapexDetailsQty"].ToString());
                    capexInformation.CapexUnitPrice        = float.Parse(dr["CapexUnitPrice"].ToString());
                    capexInformation.CapexEstimatedCost    = float.Parse(dr["CapexEstimatedCost"].ToString());
                    capexInformationMaster.CapexInformationDetails.Add(capexInformation);
                }
                capexInformationMaster.ApproverQueryModelList = new List <QueryModel>();
                dr.Close();
                dr = accessManager.GetSqlDataReader("sp_GetApproverReview", aList);
                while (dr.Read())
                {
                    QueryModel query = new QueryModel();
                    query.ApprovalId      = (int)dr["CapApproverId"];
                    query.IsApproved      = (int)dr["IsApproved"];
                    query.ApproverUserId  = (int)dr["UserId"];
                    query.UpdateDate      = dr["UpdateDate"].ToString();
                    query.ReplyMessage    = dr["ReplyMessComment"].ToString();
                    query.ReviewComment   = dr["ReviewComment"].ToString();
                    query.DesignationName = dr["DesignationName"].ToString();
                    query.ApproverName    = dr["UserName"].ToString();

                    capexInformationMaster.ApproverQueryModelList.Add(query);
                }
                capexInformationMaster.CommentsTables = new List <CommentsTable>();
                dr.Close();
                dr = accessManager.GetSqlDataReader("sp_GetAllCommentsByID", aList);
                while (dr.Read())
                {
                    CommentsTable comment = new CommentsTable();
                    comment.ReviewerByName = dr["ReviwerBY"].ToString();
                    comment.ReviewerToName = dr["ReviwerTo"].ToString();
                    comment.ReviewMessage  = dr["ReviewMessage"].ToString();
                    comment.UpdatedBY      = (DateTime)dr["UpdatedBY"];
                    capexInformationMaster.CommentsTables.Add(comment);
                }
                capexInformationMaster.CapexFileUpload = new List <CapexFileUploadDetails>();
                capexInformationMaster.CapexFileUpload = GetUploadedFilesByID(capexInfoId, userId);
                return(capexInformationMaster);
            }
            catch (Exception e)
            {
                accessManager.SqlConnectionClose(true);
                throw;
            }
            finally
            {
                accessManager.SqlConnectionClose();
            }
        }