示例#1
0
        public ObjectResult <RequestCreationMatrix> RequestCreationMatrix_GetData(RequestCreationMatrix model)
        {
            var param = new SqlParameter[] {
                new SqlParameter("@EntityType", SqlDbType.Int)
                {
                    Value = model.EntityType
                },
                new SqlParameter("@StatusType", SqlDbType.Int)
                {
                    Value = model.StatusType
                },
                new SqlParameter("@PrevStatus", SqlDbType.VarChar)
                {
                    Value = model.PrevStatus
                },
                new SqlParameter("@NewStatus", SqlDbType.VarChar)
                {
                    Value = model.NewStatus
                },
                new SqlParameter("@AccountCode", SqlDbType.VarChar)
                {
                    Value = model.AccountCode
                }
            };

            ObjectResult <RequestCreationMatrix> spResult = ((IObjectContextAdapter)this).ObjectContext.ExecuteStoreQuery <RequestCreationMatrix>("exec [CRM].[RequestCreationMatrix_GetData] @EntityType, @StatusType, @PrevStatus, @NewStatus, @AccountCode", param);

            return(spResult);
        }
示例#2
0
        public ActionResult CreateRequestGetData()
        {
            string status            = Request["status"];
            string requestID         = Request["requestID"];
            string entityType        = Request["entityType"];
            string statusType        = Request["statusType"];
            string previousStatus    = Request["previousStatus"];
            string newStatus         = Request["newStatus"];
            string updatedById       = Request["updatedById"];
            string updatedByName     = Request["updatedByName"];
            string updateTime        = Request["updateTime"];
            string customerID        = Request["customerID"];
            string accountNo         = Request["accountNo"];
            string cardNo            = Request["cardNo"];
            string mobileNo          = Request["mobileNo"];
            string customerNo        = Request["customerNo"];
            string userId            = Request["userId"];
            string emailAddress      = Request["emailAddress"];
            string snKeyBCA          = Request["snKeyBCA"];
            string corpId            = Request["corpId"];
            string category          = Request["category"];
            string additionalSummary = Request["additionalSummary"];
            string reason            = Request["reason"];
            string currentUserName   = Session["FullName"].ToString();

            Request model             = new Request();
            RequestCreationMatrix rcm = new RequestCreationMatrix();

            model.RequestID          = string.IsNullOrEmpty(requestID) ? Guid.Empty : new Guid(requestID);
            model.CustomerID         = string.IsNullOrEmpty(customerID) ? Guid.Empty : new Guid(customerID);
            model.TransactionTime    = updateTime;
            model.AccountNo          = accountNo;
            model.CardNo             = cardNo;
            model.CustomerNo         = customerNo;
            model.CommunicationPhone = mobileNo;
            model.ModifiedByName     = currentUserName;
            model.Title  = " - " + additionalSummary;
            model.Reason = reason;

            rcm.EntityType = string.IsNullOrEmpty(entityType) ? 0 : int.Parse(entityType);
            rcm.StatusType = string.IsNullOrEmpty(statusType) ? 0 : int.Parse(statusType);
            rcm.PrevStatus = previousStatus;
            rcm.NewStatus  = newStatus;
            if (rcm.EntityType == 4)
            {
                rcm.AccountCode = category;
            }
            else
            {
                rcm.AccountCode = "0";
            }

            return(CreateRequestForChangeStatus(model, rcm, userId, snKeyBCA, corpId, status));
        }
        public ActionResult Create()
        {
            RequestCreationMatrix model = new RequestCreationMatrix();

            ViewBag.DDL_eBanking      = this.GetEntityTypes();
            ViewBag.DDL_accountCode   = this.GetAccountCode();
            ViewBag.DDL_RequestStatus = this.GetRequestStatus();

            model.RequestStatus = 5; /*Always Closed, Confirm by RCH (20151126)*/

            return(View(model));
        }
        public ActionResult Edit(Guid Id)
        {
            RequestCreationMatrix model = db.requestCreationMatrix.Find(Id);

            ViewBag.DDL_eBanking      = this.GetEntityTypes();
            ViewBag.DDL_StatusType    = this.GetStatusTypes(model.EntityType);
            ViewBag.DDL_PrevStatus    = this.GetPreviousStatus(model.EntityType, model.StatusType);
            ViewBag.DDL_NewStatus     = this.GetNewStatus(model.EntityType, model.StatusType, model.PrevStatus);
            ViewBag.DDL_accountCode   = this.GetAccountCode();
            ViewBag.DDL_RequestStatus = this.GetRequestStatus();
            ViewBag.Title             = string.Format("Request Creation Matrix: {0}", model.Summary);

            model.RequestStatus = 5; /*Request Status always "Closed", confirmed by RCH*/
            return(View(model));
        }
示例#5
0
        public ActionResult CreateRequestForChangeStatus(Request model, RequestCreationMatrix rcm, string userId, string serialNumber, string corpId, string status)
        {
            if (status == "cancel")
            {
                return(formSubmit(model, "CancelFromRCM"));
            }
            else if (status == "close")
            {
                return(formSubmit(model, "CloseFromRCM"));
            }
            else
            {
                if (rcm.AccountCode == "C")
                {
                    rcm.AccountCode = "B";
                }
                var RCM_data = db.RequestCreationMatrix_GetData(rcm).ToList();
                if (RCM_data.Count >= 1 && RCM_data[0] != null)
                {
                    model.ProductID  = RCM_data[0].ProductID;
                    model.CategoryID = RCM_data[0].CategoryID;
                    model.StatusCode = RCM_data[0].RequestStatus;
                    model.Title      = RCM_data[0].Summary + model.Title;

                    string CIS = "";
                    if (model.CustomerID != null)
                    {
                        CIS = db.customer.Find(model.CustomerID).CISNumber;
                    }
                    model.Title            = getSummary(model.Title, userId, corpId, model.CommunicationPhone, serialNumber, CIS, model.ModifiedByName);
                    model.CaseOriginCode   = 200003;
                    model.Location         = 1;
                    model.ContactMethod    = 1;
                    model.CustomerAttitude = 3;
                    model.PriorityCode     = 2;
                    model.ForCustomer      = true;
                    return(formSubmit(model, "CreateFromRCM"));
                }
                else
                {
                    var jsonData = new { flag = false, state = 0, CHECK = "ga ada rcm" };
                    return(Json(jsonData));
                }
            }
        }
示例#6
0
        public KeyValuePair <int, String> RequestCreationMatrix_Delete(RequestCreationMatrix model)
        {
            var param = new SqlParameter[] {
                new SqlParameter("@RequestCreationMatrixID", model.RequestCreationMatrixID),
                new SqlParameter("@ModifiedBy", model.ModifiedBy),
                new SqlParameter("@RetVal", SqlDbType.Int)
                {
                    Direction = ParameterDirection.Output
                },
                new SqlParameter("@Message", SqlDbType.NVarChar, 100)
                {
                    Direction = ParameterDirection.Output
                }
            };

            int rc = ((IObjectContextAdapter)this).ObjectContext.ExecuteStoreCommand("EXEC [CRM].[RequestCreationMatrix_Delete] @RequestCreationMatrixID, @ModifiedBy, @RetVal out, @Message out", param);

            int    retVal   = (int)param[2].Value;
            string valueRes = param[3].Value.ToString();

            return(new KeyValuePair <int, string>(retVal, valueRes));
        }
        public ActionResult FormSubmit(RequestCreationMatrix model, ActionType actionType)
        {
            try
            {
                if (Session["CurrentUserID"] == null)
                {
                    throw new Exception(Resources.RequestCreationMatrix.Alert_SessionIsNull);
                }

                model.ModifiedBy    = new Guid(Session["CurrentUserID"].ToString());
                model.RequestStatus = 5; /*Always "Closed", Confrimed By RCH*/

                if (ModelState.IsValid)
                {
                    KeyValuePair <int, string> results = new KeyValuePair <int, string>(1, "");
                    if (actionType.Equals(ActionType.Create))
                    {
                        model.RequestCreationMatrixID = Guid.NewGuid();
                        results = db.RequestCreationMatrix_Insert(model);
                    }
                    else if (actionType.Equals(ActionType.Edit))
                    {
                        results = db.RequestCreationMatrix_Update(model);
                    }
                    else if (actionType.Equals(ActionType.ChangeStatus))
                    {
                        results = db.RequestCreationMatrix_ChangeStatus(model);
                    }
                    else if (actionType.Equals(ActionType.Delete))
                    {
                        results = db.RequestCreationMatrix_Delete(model);
                    }

                    if (results.Key == 0 || results.Key == 16 || results.Key == 6)
                    {
                        UrlHelper u = new UrlHelper(this.ControllerContext.RequestContext);
                        string    controllerName = this.ControllerContext.RouteData.Values["Controller"].ToString();
                        string    url            = u.Action("Edit", controllerName, new { id = model.RequestCreationMatrixID, success = Resources.RequestCreationMatrix.Alert_SubmissionSuccess });
                        string    urlNew         = u.Action("Create", controllerName);

                        var jsonData = new { flag = true, Message = url, urlNew = urlNew };
                        return(Json(jsonData));
                    }
                    else
                    {
                        throw new Exception(results.Value.ToString());
                    }
                }
                else
                {
                    string errorMessage = string.Empty;
                    foreach (var key in ModelState.Keys)
                    {
                        var error = ModelState[key].Errors.FirstOrDefault();
                        if (error != null)
                        {
                            errorMessage = error.ErrorMessage;
                            break;
                        }
                    }

                    throw new Exception(errorMessage);
                }
            }
            catch (Exception e)
            {
                var jsonData = new { flag = false, Message = e.Message };
                return(Json(jsonData));
            }
        }
 public ActionResult Delete(RequestCreationMatrix model)
 {
     return(FormSubmit(model, ActionType.Delete));
 }
 public ActionResult ChangeStatus(RequestCreationMatrix model)
 {
     return(FormSubmit(model, ActionType.ChangeStatus));
 }
 public ActionResult Edit(RequestCreationMatrix model)
 {
     return(FormSubmit(model, ActionType.Edit));
 }
 public ActionResult Create(RequestCreationMatrix model)
 {
     model.RequestStatus = 5;
     return(FormSubmit(model, ActionType.Create));
 }
示例#12
0
        public KeyValuePair <int, String> RequestCreationMatrix_Update(RequestCreationMatrix model)
        {
            var param = new SqlParameter[] {
                new SqlParameter("@RequestCreationMatrixID", SqlDbType.UniqueIdentifier)
                {
                    Value = model.RequestCreationMatrixID
                },
                new SqlParameter("@StatusChangeID", SqlDbType.UniqueIdentifier)
                {
                    Value = CheckForDbNull(model.StatusChangeID)
                },
                new SqlParameter("@AccountCode", SqlDbType.NChar)
                {
                    Value = CheckForDbNull(model.AccountCode)
                },
                new SqlParameter("@RequestStatus", SqlDbType.Int)
                {
                    Value = CheckForDbNull(model.RequestStatus)
                },
                new SqlParameter("@Summary", SqlDbType.NVarChar)
                {
                    Value = model.Summary
                },
                new SqlParameter("@ProductID", SqlDbType.UniqueIdentifier)
                {
                    Value = model.ProductID
                },
                new SqlParameter("@CategoryID", SqlDbType.UniqueIdentifier)
                {
                    Value = model.CategoryID
                },
                new SqlParameter("@ModifiedBy", SqlDbType.UniqueIdentifier)
                {
                    Value = model.ModifiedBy
                },
                new SqlParameter("@RetVal", SqlDbType.Int)
                {
                    Direction = ParameterDirection.Output
                },
                new SqlParameter("@Message", SqlDbType.NVarChar, 100)
                {
                    Direction = ParameterDirection.Output
                }
            };

            List <string> listParams = new List <string>();

            listParams.Add("@RequestCreationMatrixID");
            listParams.Add("@StatusChangeID");
            listParams.Add("@AccountCode");
            listParams.Add("@RequestStatus");
            listParams.Add("@Summary");
            listParams.Add("@ProductID");
            listParams.Add("@CategoryID");
            listParams.Add("@ModifiedBy");
            listParams.Add("@RetVal out");
            listParams.Add("@Message out");

            StringBuilder sBuilder = new StringBuilder();

            sBuilder.Append("EXEC [CRM].[RequestCreationMatrix_Update]");
            sBuilder.Append(string.Join(",", listParams.ToArray()));
            int result = ((IObjectContextAdapter)this).ObjectContext.ExecuteStoreCommand(sBuilder.ToString(), param);

            int    retVal  = (int)param[listParams.Count - 2].Value;
            string message = (string)param[listParams.Count - 1].Value;

            return(new KeyValuePair <int, string>(retVal, message));
        }