/// <summary> /// Insert data /// </summary> private void InsertData() { //Get and Insert Data RC_HandoverData data = new RC_HandoverData(); ITransaction tran = factory.GetInsertObject(data); data.ContractId = lblId.Text.Trim(); data.Item = txtItem.Text.Trim(); data.ReceiveDate = Func.FormatYYYYmmdd(txtReceiveDate.Text.Substring(0, 10)); data.Mount = txtMount.Text.Trim(); data.PriceVND = txtPriceVND.Text.Trim(); data.PriceUSD = txtPriceUSD.Text.Trim().Replace(",", "."); data.Handover = txtHandover.Text.Trim(); data.Receiver = txtReceiver.Text.Trim(); data.Description = txtDescription.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"; 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); btnRegister.CommandName = "Register"; hidAction.Value = "Edit"; lblId.Enabled = false; hidId.Value = data.id; //lblCreated.Text = !"".Equals(data.Created) ? data.CreatedBy + "(" + Func.Formatdmyhms(data.Created) + ")" : ""; //lblModified.Text = !"".Equals(data.Modified) ? data.ModifiedBy + "(" + Func.Formatdmyhms(data.Modified) + ")" : ""; ShowData(); } else { OperationLogger.WriteError(Constants.LogOperationAlbumId, Constants.LogActionInsertId, addUnSuccess, Page.User.Identity.Name); mvMessage.AddError(addUnSuccess); } }
/// <summary> /// Load data /// </summary> private void LoadData() { RentContractData data = new RentContractData(); ITransaction tran = factory.GetLoadObject(data, hidRcID.Value); Execute(tran); if (!HasError) { //Get Data data = (RentContractData)tran.Result; lblId.Text = data.ContractId; lblCustomerId.Text = data.CustomerId; } RC_HandoverData dataHandover = new RC_HandoverData(); ITransaction tranHandover = factory.GetLoadObject(dataHandover, hidId.Value); Execute(tranHandover); if (!HasError) { //Get Data dataHandover = (RC_HandoverData)tranHandover.Result; txtItem.Text = dataHandover.Item; txtMount.Text = dataHandover.Mount; ShowData(); } }