protected void Page_Load(object sender, EventArgs e) { IReason ReasonManager; try { if (!IsPostBack) { ReasonManager = (IReason)ObjectFactory.CreateInstance("BusinessProcess.Administration.BReason, BusinessProcess.Administration"); DataSet theDS = ReasonManager.GetReason(); this.grdReason.DataSource = theDS.Tables[0]; ViewState["gridSortDirection"] = "Desc"; //this.grdReason.DataBind(); //this.grdReason.Columns[0].Visible = false; if (ViewState["grdDataSource"] == null) { ViewState["grdDataSource"] = theDS.Tables[0]; } ViewState["SortDirection"] = "Desc"; BindGrid(); } } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareMsgBox.Show("#C1", this); return; } finally { ReasonManager = null; } }
public string GetReasonById(string data) { var id = JsonConvert.DeserializeObject <Guid>(data); if (id != Guid.Empty) { var r = ReasonManager.GetReason(id); var reason = new EditReason { NAME = r.TEXT, ID = r.ID }; return(JsonConvert.SerializeObject(reason)); } return(JsonConvert.SerializeObject(new REASON())); }