protected void btnUpdatePaymentType_Click(object sender, EventArgs e) { //Get and Insert Data BD_PaymentTypeData data = new BD_PaymentTypeData(); ITransaction tran = factory.GetLoadObject(data, drpUpdatePayment.SelectedValue); Execute(tran); if (!HasError) { //Get Data data = (BD_PaymentTypeData)tran.Result; data.PaymentType = txtPaymentType.Text; tran = factory.GetUpdateObject(data); Execute(tran); if (!HasError) { OperationLogger.WriteInfo(Constants.LogOperationAlbumId, Constants.LogActionUpdateId, updateSuccess, Page.User.Identity.Name); mvMessage.SetCompleteMessage(updateSuccess); DbHelper.FillList(drpPaymentType, "Select * from BD_PaymentType Where BuildingId = '" + Func.ParseString(Session["__BUILDINGID__"]) + "'", "PaymentType", "id"); ShowData(); } else { OperationLogger.WriteError(Constants.LogOperationAlbumId, Constants.LogActionUpdateId, updateUnSuccess, Page.User.Identity.Name); mvMessage.AddError(updateUnSuccess); } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAddPaymentType_Click(object sender, EventArgs e) { //Get and Insert Data BD_PaymentTypeData data = new BD_PaymentTypeData(); ITransaction tran = factory.GetInsertObject(data); data.PaymentType = txtPaymentType.Text.Trim(); data.BuildingId = Func.ParseString(Session["__BUILDINGID__"]); 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); DbHelper.FillList(drpPaymentType, "Select * from BD_PaymentType Where BuildingId = '" + Func.ParseString(Session["__BUILDINGID__"]) + "'", "PaymentType", "id"); ShowData(); } else { OperationLogger.WriteError(Constants.LogOperationAlbumId, Constants.LogActionInsertId, addUnSuccess, Page.User.Identity.Name); mvMessage.AddError(addUnSuccess); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAddPaymentType_Click(object sender, EventArgs e) { mvMessage.CheckRequired(txtPaymentType, "Danh mục Thu/Chi là yêu cầu bắt buộc"); if (!mvMessage.IsValid) return; //Get and Insert Data BD_PaymentTypeData data = new BD_PaymentTypeData(); ITransaction tran = factory.GetInsertObject(data); data.Name = txtPaymentType.Text.Trim(); data.BuildingId = Func.ParseString(Session["__BUILDINGID__"]); data.ItemLevel = "0"; 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); //DbHelper.FillList(drpPaymentType, "Select * from BD_PaymentType Where BuildingId = '" + Func.ParseString(Session["__BUILDINGID__"]) + "' and Delflag = '0'", "Name", "id"); DbHelper.FillList(drpPaymentType, "Select Name,Id from BD_PaymentType Where delflag = 0 and BuildingId = '" + Func.ParseString(Session["__BUILDINGID__"]) + "' Union Select Name, id From Mst_PaymentType", "Name", "id"); ShowData(); } else { OperationLogger.WriteError(Constants.LogOperationAlbumId, Constants.LogActionInsertId, addUnSuccess, Page.User.Identity.Name); mvMessage.AddError(addUnSuccess); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSetting_Click(object sender, EventArgs e) { //Get and Insert Data BD_PaymentTypeData data = new BD_PaymentTypeData(); ITransaction tran = factory.GetLoadObject(data, drpPaymentType.SelectedValue); Execute(tran); if (!HasError) { //Get Data data = (BD_PaymentTypeData)tran.Result; data.ParentId = drpParentPaymentType.SelectedValue; tran = factory.GetUpdateObject(data); Execute(tran); if (!HasError) { OperationLogger.WriteInfo(Constants.LogOperationAlbumId, Constants.LogActionUpdateId, updateSuccess, Page.User.Identity.Name); mvMessage.SetCompleteMessage(updateSuccess); ShowData(); } else { OperationLogger.WriteError(Constants.LogOperationAlbumId, Constants.LogActionUpdateId, updateUnSuccess, Page.User.Identity.Name); mvMessage.AddError(updateUnSuccess); } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSetting_Click(object sender, EventArgs e) { int level = Func.ParseInt(DbHelper.GetScalar("Select isnull(itemlevel,0) + 1 from BD_PaymentType where id = '" + drpParentPaymentType.SelectedValue + "'")); string paidType = DbHelper.GetScalar("Select PaidType from BD_PaymentType where id = '" + drpParentPaymentType.SelectedValue + "'"); if (drpParentPaymentType.SelectedValue.Equals("9")) { level = 1; paidType = "1"; } if (drpParentPaymentType.SelectedValue.Equals("10")) { level = 1; paidType = "0"; } if (level >= 4) { mvMessage.AddError("Không thể thiết lập vì Tối đa chỉ có 4 cấp Thu/Chi"); return; } //Get and Insert Data BD_PaymentTypeData data = new BD_PaymentTypeData(); ITransaction tran = factory.GetLoadObject(data, drpPaymentType.SelectedValue); Execute(tran); if (!HasError) { //Get Data data = (BD_PaymentTypeData)tran.Result; data.ParentId = drpParentPaymentType.SelectedValue; data.ItemLevel = Func.ParseString(level); data.PaidType = paidType; tran = factory.GetUpdateObject(data); Execute(tran); if (!HasError) { OperationLogger.WriteInfo(Constants.LogOperationAlbumId, Constants.LogActionUpdateId, updateSuccess, Page.User.Identity.Name); mvMessage.SetCompleteMessage(updateSuccess); ShowData(); } else { OperationLogger.WriteError(Constants.LogOperationAlbumId, Constants.LogActionUpdateId, updateUnSuccess, Page.User.Identity.Name); mvMessage.AddError(updateUnSuccess); } } }