public KeyValuePair <int, String> OrganizationClosure_ChangeStatus(OrganizationClosure model) { var param = new SqlParameter[] { new SqlParameter("@OrganizationClosureID", SqlDbType.UniqueIdentifier) { Value = model.OrganizationClosureID }, 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 } }; int rc = ((IObjectContextAdapter)this).ObjectContext.ExecuteStoreCommand("exec [CRM].[OrganizationClosure_ChangeStatus] @OrganizationClosureID, @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(OrganizationClosure organizationClosure, string actionType) { List <string> errorMessage = new List <string>(); string successMessage = Resources.NotifResource.RequestSuccess; SessionForSP sessionParam = new SessionForSP(); sessionParam.OrganizationID = new Guid(Session["OrganizationID"].ToString()); if (ModelState.IsValid) { KeyValuePair <int, string> results = new KeyValuePair <int, string>(1, ""); organizationClosure.ModifiedBy = new Guid(Session["CurrentUserID"].ToString()); if (actionType == "Create") { organizationClosure.OrganizationClosureID = Guid.NewGuid(); results = db.OrganizationClosure_Insert(organizationClosure, sessionParam); } else if (actionType == "Edit") { results = db.OrganizationClosure_Update(organizationClosure); } else if (actionType == "ChangeStatus") { results = db.OrganizationClosure_ChangeStatus(organizationClosure); } else if (actionType == "Delete") { results = db.OrganizationClosure_Delete(organizationClosure); } if (results.Key == 0 || results.Key == 16 || results.Key == 6) { UrlHelper u = new UrlHelper(this.ControllerContext.RequestContext); string url = u.Action("Edit", "OrganizationClosure", new { id = organizationClosure.OrganizationClosureID, success = successMessage }); string urlNew = u.Action("Create", "OrganizationClosure"); var jsonData = new { flag = true, Message = url, urlNew = urlNew }; return(Json(jsonData)); } else { var jsonData = new { flag = false, Message = results.Value.ToString() }; return(Json(jsonData)); } } else { foreach (var key in ModelState.Keys) { var error = ModelState[key].Errors.FirstOrDefault(); if (error != null) { errorMessage.Add(error.ErrorMessage); } } var jsonData = new { flag = false, Message = errorMessage.First() }; return(Json(jsonData)); } }
public KeyValuePair <int, String> OrganizationClosure_Insert(OrganizationClosure model, SessionForSP sessionParam) { var param = new SqlParameter[] { new SqlParameter("@OrganizationClosureID", SqlDbType.UniqueIdentifier) { Value = CheckForDbNull(model.OrganizationClosureID) }, new SqlParameter("@Name", SqlDbType.NVarChar, 200) { Value = CheckForDbNull(model.Name) }, new SqlParameter("@StartDate", SqlDbType.DateTime) { Value = CheckForDbNull(model.StartDate) }, new SqlParameter("@EndDate", SqlDbType.DateTime) { Value = CheckForDbNull(model.EndDate) }, new SqlParameter("@ModifiedBy", SqlDbType.UniqueIdentifier) { Value = model.ModifiedBy }, new SqlParameter("@OrganizationID", sessionParam.OrganizationID), 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].[OrganizationClosure_Insert] @OrganizationClosureID, @Name, @StartDate, @EndDate, @ModifiedBy, @OrganizationID, @RetVal out, @Message out", param); int retVal = (int)param[6].Value; string valueRes = param[7].Value.ToString(); return(new KeyValuePair <int, string>(retVal, valueRes)); }
public ActionResult Delete(OrganizationClosure model) { return(formSubmit(model, "Delete")); }
public ActionResult ChangeStatus(OrganizationClosure model) { return(formSubmit(model, "ChangeStatus")); }
public ActionResult Edit(OrganizationClosure model) { return(formSubmit(model, "Edit")); }
public ActionResult Edit(Guid id) { OrganizationClosure organizationClosure = db.organizationClosure.Find(id); return(View(organizationClosure)); }
public ActionResult Create() { OrganizationClosure organizationClosure = new OrganizationClosure(); return(View(organizationClosure)); }