private void UpdateData() { BD_StaffEvalInfoData data = new BD_StaffEvalInfoData(); ITransaction tran = factory.GetLoadObject(data, hidID.Value); Execute(tran); if (!HasError) { //Get Data data = (BD_StaffEvalInfoData)tran.Result; data.ContentEval = txtContentEval.Text.Trim(); data.EvalDate = Func.FormatYYYYmmdd(txtEvalDate.Text.Trim()); data.Comment = txtComment.Text.Trim(); data.ModifiedBy = Page.User.Identity.Name; data.Modified = DateTime.Now.ToString("yyyyMMddHHmmss"); data.DelFlag = "0"; tran = factory.GetUpdateObject(data); Execute(tran); if (!HasError) { OperationLogger.WriteInfo(Constants.LogOperationAlbumId, Constants.LogActionInsertId, updateSuccess, Page.User.Identity.Name); mvMessage.SetCompleteMessage(updateSuccess); } else { OperationLogger.WriteError(Constants.LogOperationAlbumId, Constants.LogActionInsertId, updateUnSuccess, Page.User.Identity.Name); mvMessage.AddError(updateUnSuccess); } } }
/// <summary> /// Insert data /// </summary> private void InsertData() { //Get and Insert Data BD_StaffEvalInfoData data = new BD_StaffEvalInfoData(); ITransaction tran = factory.GetInsertObject(data); data.ContentEval = txtContentEval.Text.Trim(); data.EvalDate = Func.FormatYYYYmmdd(txtEvalDate.Text.Trim()); data.Comment = txtComment.Text.Trim(); data.ModifiedBy = Page.User.Identity.Name; data.CreatedBy = Page.User.Identity.Name; data.Created = DateTime.Now.ToString("yyyyMMddHHmmss"); data.Modified = DateTime.Now.ToString("yyyyMMddHHmmss"); data.DelFlag = "0"; data.StaffId = hidID.Value; Execute(tran); if (!HasError) { OperationLogger.WriteInfo(Constants.LogOperationAlbumId, Constants.LogActionInsertId, addSuccess, Page.User.Identity.Name); mvMessage.SetCompleteMessage(addSuccess); ScriptManager.RegisterClientScriptBlock(this.btnRegister, this.GetType(), key, postback, true); txtContentEval.Text = ""; txtEvalDate.Text = ""; txtComment.Text = ""; ShowData(); } else { OperationLogger.WriteError(Constants.LogOperationAlbumId, Constants.LogActionInsertId, addUnSuccess, Page.User.Identity.Name); mvMessage.AddError(addUnSuccess); } }
/// <summary> /// Load data /// </summary> private void LoadData() { id = Request["id"]; hidID.Value = id; BD_StaffEvalInfoData data = new BD_StaffEvalInfoData(); ITransaction tran = factory.GetLoadObject(data, id); Execute(tran); if (!HasError) { //Get Data data = (BD_StaffEvalInfoData)tran.Result; txtContentEval.Text = data.ContentEval; txtEvalDate.Text = Func.FormatDMY(data.EvalDate); txtComment.Text = data.Comment; BD_StaffData dataS = new BD_StaffData(); ITransaction tranS = factory.GetLoadObject(dataS, data.StaffId); Execute(tranS); if (!HasError) { //Get Data dataS = (BD_StaffData)tranS.Result; lblStaffId.Text = dataS.StaffId; lblName.Text = dataS.Name; } } }
/// <summary> /// Update /// </summary> private void DeleteData(string strId) { BD_StaffEvalInfoData data = new BD_StaffEvalInfoData(); ITransaction tran = factory.GetLoadObject(data, strId); Execute(tran); if (!HasError) { //Get Data data = (BD_StaffEvalInfoData)tran.Result; data.DelFlag = "1"; tran = factory.GetUpdateObject(data); Execute(tran); if (!HasError) { OperationLogger.WriteInfo(Constants.LogOperationAlbumId, Constants.LogActionUpdateId, deleteSuccess, Page.User.Identity.Name); mvMessage.SetCompleteMessage(deleteSuccess); ScriptManager.RegisterClientScriptBlock(this.btnRegister, this.GetType(), key, postback, true); } else { OperationLogger.WriteError(Constants.LogOperationAlbumId, Constants.LogActionUpdateId, deleteUnSuccess, Page.User.Identity.Name); mvMessage.AddError(deleteUnSuccess); } } }