示例#1
0
        public static ResponseMsg editNBVarianceComment(int[] internalOrders, string comment)
        {
            //Session Login Check
            if (HttpContext.Current.Session["Connection"] == null)
            {
                throw new Exception("Session State Timeout");
            }

            //Variables
            ResponseMsg result = new ResponseMsg();

            //Create New Buy Variance Comment edit request
            NBVarianceCommentEditRequest editRequest = new NBVarianceCommentEditRequest();

            editRequest.internalOrderNo = internalOrders;
            editRequest.comment         = comment.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);
            }

            //Update database using request
            using (Interface db = new Interface())
            {
                result = db.editNBVarianceComment(editRequest);
            }

            return(result);
        }
示例#2
0
        public static ResponseMsg editOrdGrid(string cost_charge_number, string due_date, int id,
                                              int internal_order_no, string oper, int order_quantity, int priority,
                                              int requirement_schedule_no, int activity_status, string part_no, string change_reason)
        {
            //Session Login Check
            if (HttpContext.Current.Session["Connection"] == null)
            {
                throw new Exception("Session State Timeout");
            }

            //Variables
            ResponseMsg result = new ResponseMsg();

            //Create request
            CCADOrderEditRequest editRequest = new CCADOrderEditRequest();

            editRequest.cost_charge_number = (cost_charge_number.Trim()).ToUpper();
            editRequest.due_date           = due_date.Trim();
            editRequest.internal_order_no  = internal_order_no;
            editRequest.oper                    = oper.Trim();
            editRequest.order_quantity          = order_quantity;
            editRequest.priority                = priority;
            editRequest.requirement_schedule_no = requirement_schedule_no;
            editRequest.activity_status         = activity_status;
            editRequest.change_reason           = change_reason;
            editRequest.part_no                 = part_no;

            //Validate request input
            if (!editRequest._isValid())
            {
                //set error message
                result.addError("Your request to edit this order 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.editCCADOrder(editRequest);
                }
                else if (editRequest.oper == "delete")
                {
                    result = db.deleteCCADOrder(editRequest);
                }
                else if (editRequest.oper == "new")
                {
                    result = db.newCCADOrder(editRequest);
                }
            }

            return(result);
        }
示例#3
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);
        }
示例#4
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
            CLSRemarkEditRequest editRequest = new CLSRemarkEditRequest();

            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.editCLSccbRemark(editRequest);
                }
            }

            return(result);
        }
示例#5
0
        public static ResponseMsg multiEdit(string oper, string[] orders)
        {
            //Session Login Check
            if (HttpContext.Current.Session["Connection"] == null)
            {
                throw new Exception("Session State Timeout");
            }

            //Variables
            ResponseMsg result = new ResponseMsg();

            //Create paging request
            CLSMultiOrderEditRequest editRequest = new CLSMultiOrderEditRequest();

            editRequest.oper = oper.Trim().ToLower();
            foreach (string order in orders)
            {
                editRequest.orders.Add(order.Trim().ToUpper());
            }

            //Validate request input
            if (!editRequest._isValid())
            {
                //set error message
                result.addError("Your Request to edit these orders contains invalid input and was canceled.");

                //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
                switch (editRequest.oper)
                {
                case "approve":
                {
                    result = db.approveCLSCcbOrders(editRequest);
                    break;
                }

                case "reject":
                {
                    result = db.rejectCLSCcbOrders(editRequest);
                    break;
                }

                default:
                {
                    result.addError("A valid operation was not specified. No changes were made.");
                    break;
                }
                }
            }

            return(result);
        }
示例#6
0
        public static ResponseMsg editSegcodeGrid(string oper, string id, string seg_code, string program_code,
                                                  string buy_method, string include_in_bolt, string include_in_spo, string include_in_tav_reporting,
                                                  string site_location)
        {
            //Session Login Check
            if (HttpContext.Current.Session["Connection"] == null)
            {
                throw new Exception("Session State Timeout");
            }

            //Variables
            ResponseMsg result = new ResponseMsg();

            //Create request
            SegcodeEditRequest editRequest = new SegcodeEditRequest();

            editRequest.oper                     = oper.Trim().ToLower();
            editRequest.id                       = id.Trim().ToUpper();
            editRequest.seg_code                 = seg_code.Trim().ToUpper();
            editRequest.program_code             = program_code.Trim().ToUpper();
            editRequest.buy_method               = buy_method.Trim();
            editRequest.include_in_bolt          = include_in_bolt.Trim().ToUpper();
            editRequest.include_in_spo           = include_in_spo.Trim().ToUpper();
            editRequest.include_in_tav_reporting = include_in_tav_reporting.Trim().ToUpper();
            editRequest.site_location            = site_location.Trim();

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

                //Return invalid request
                return(result);
            }

            //Edit database using request
            using (Interface db = new Interface())
            {
                try
                {
                    //Check if user has permissions to edit
                    if (!db.checkSegcodeEditPerm())
                    {
                        //set error message
                        result.addMsg("You do not have permission to edit segcodes.");

                        //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);
                }

                //Perform action
                if (editRequest.oper == "edit")
                {
                    result = db.editSegcode(editRequest);
                }
                else if (editRequest.oper == "delete")
                {
                    result = db.deleteSegcode(editRequest);
                }
                else if (editRequest.oper == "new")
                {
                    result = db.newSegcode(editRequest);
                }
            }

            return(result);
        }
示例#7
0
        public static ResponseMsg multiEditOrdGrid(string oper, string[] orders)
        {
            //Session Login Check
            if (HttpContext.Current.Session["Connection"] == null)
            {
                throw new Exception("Session State Timeout");
            }

            //Variables
            ResponseMsg result = new ResponseMsg();

            //Create request
            CCADMultiOrderEditRequest editRequest = new CCADMultiOrderEditRequest();

            editRequest.oper = oper.Trim().ToLower();
            foreach (string order in orders)
            {
                editRequest.orders.Add(order.Trim().ToUpper());
            }

            //Validate request input
            if (!editRequest._isValid())
            {
                //set error message
                result.addError("Your Request to edit these orders contains invalid input and was canceled.");

                //Return invalid request
                return(result);
            }

            //Edit database using request
            using (Interface db = new Interface())
            {
                switch (editRequest.oper)
                {
                case "approve":
                {
                    result = db.approveCCADAmOrders(editRequest);
                    break;
                }

                case "validate":
                {
                    result = db.validateCCADOrders(editRequest);
                    break;
                }

                case "delete":
                {
                    result = db.deleteCCADOrders(editRequest);
                    break;
                }

                case "reject":
                {
                    result = db.rejectCCADOrders(editRequest);
                    break;
                }

                default:
                {
                    result.addError("A valid operation was not specified. No changes were made.");
                    break;
                }
                }
            }

            return(result);
        }