예제 #1
0
        public static ResponseMsg editAmRemark(string oper, string id, string asset_manager_remark)
        {
            //Session Login Check
            if (HttpContext.Current.Session["Connection"] == null)
            {
                throw new Exception("Session State Timeout");
            }

            //Variables
            ResponseMsg result = new ResponseMsg();

            //Create edit request
            CCADRemarkEditRequest editRequest = new CCADRemarkEditRequest();

            editRequest.oper     = oper.Trim().ToLower();
            editRequest.order_no = id.Trim().ToUpper();
            editRequest.remark   = asset_manager_remark.Trim();

            //Validate request input
            if (!editRequest._isValid())
            {
                //set error message
                result.addError("Your request to edit this remark contains invalid input and was not saved.");

                //Return invalid request
                return(result);
            }

            //Edit database using request
            using (Interface db = new Interface())
            {
                if (editRequest.oper == "edit")
                {
                    result = db.editCCADAmRemark(editRequest);
                }
            }

            return(result);
        }
예제 #2
0
        public static ResponseMsg editCcbRemark(string oper, string id, string review_board_remark)
        {
            //Session Login Check
            if (HttpContext.Current.Session["Connection"] == null)
            {
                throw new Exception("Session State Timeout");
            }

            //Variables
            ResponseMsg result = new ResponseMsg();

            //Create edit request
            CCADRemarkEditRequest editRequest = new CCADRemarkEditRequest();

            editRequest.oper     = oper.Trim().ToLower();
            editRequest.order_no = id.Trim().ToUpper();
            editRequest.remark   = review_board_remark.Trim();

            //Validate request input
            if (!editRequest._isValid())
            {
                //set error message
                result.addError("Your request to edit the ccb remarks contains invalid input and was not saved.");

                //Return invalid request
                return(result);
            }

            //Create db interface instance
            using (Interface db = new Interface())
            {
                try
                {
                    //Check if user has permissions to edit
                    if (!Convert.ToBoolean(HttpContext.Current.Session["rev"]))
                    {
                        //set error message
                        result.addError("Reviewer role required to make changes.");

                        //Return request
                        return(result);
                    }
                }
                catch (Exception)
                {
                    //set error message
                    result.addError("Unable to verify permissions. Please try again or contact application support.");

                    //Return request
                    return(result);
                }

                //Edit database using request
                if (editRequest.oper == "edit")
                {
                    result = db.editCCADccbRemark(editRequest);
                }
            }

            return(result);
        }