protected void lbtnEdit_Click(object sender, EventArgs e) { if (Permission.IsAllowedUpdate) { FeeManager feeManager = new FeeManager(); LinkButton lbtnEdit = (LinkButton)sender; int feeTypeId = int.Parse(lbtnEdit.CommandArgument); DataTable dt = feeManager.FeeType_GetList_FeeTypeId(feeTypeId); if (dt != null && dt.Rows.Count > 0) { lblFeeTypeStatus.Visible = true; ddlFeeTypeStatus.Visible = true; LoadFeeTypeStatus(); DataRow dr = dt.Rows[0]; txtFeeTypeName.Text = dr["FeeTypeName"].ToString(); ddlFeeTypeStatus.SelectedValue = dr["FeeTypeStatus"].ToString(); hfFeeTypeId.Value = feeTypeId.ToString(); btnAdd.Text = "Cập nhật"; btnAdd.CommandName = "Edit"; } else { ErrorBox.Message = "Không load được dữ liệu"; NotifyBox.Message = string.Empty; } } else { ErrorBox.Message = "Không có quyền thực hiện thao tác này"; } }
private void LoadFeeType() { try { FeeManager feeManager = new FeeManager(); DataTable dt = feeManager.FeeType_GetList(); if (dt != null && dt.Rows.Count > 0) { ddlFeeType.DataSource = dt; ddlFeeType.DataValueField = "FeeTypeId"; ddlFeeType.DataTextField = "FeeTypeName"; ddlFeeType.DataBind(); ErrorBox.Message = string.Empty; NotifyBox.Message = string.Empty; } else { ErrorBox.Message = "Không có dữ liệu"; NotifyBox.Message = string.Empty; } } catch (Exception ex) { ErrorBox.Message = "Lỗi chức năng"; NotifyBox.Message = string.Empty; SaveErrorLog(ex); } }
private void SaveData(int action) { try { int code = -1, id, feeTypeStatus; string msg = "", feeTypeName; FeeManager feeManager = new FeeManager(); feeTypeName = txtFeeTypeName.Text.Trim(); if (action == 1) //Add { feeManager.FeeType_Insert(feeTypeName, ref code, ref msg); if (code == 0) { ErrorBox.Message = string.Empty; NotifyBox.Message = "Lưu dữ liệu thành công"; } else { ErrorBox.Message = "Lưu dữ liệu thất bại"; NotifyBox.Message = string.Empty; } SaveActionLog("Thêm mới", string.Format("code: {0}; msg: {1}", code, msg)); } else if (action == 2) //Edit { feeTypeStatus = int.Parse(ddlFeeTypeStatus.SelectedValue); id = int.Parse(hfFeeTypeId.Value); feeManager.FeeType_Update(id, feeTypeName, feeTypeStatus, ref code, ref msg); if (code == 0) { ErrorBox.Message = string.Empty; NotifyBox.Message = "Lưu dữ liệu thành công"; btnAdd.Text = "Thêm mới"; btnAdd.CommandName = "Add"; } else { ErrorBox.Message = "Lưu dữ liệu thất bại"; NotifyBox.Message = string.Empty; } SaveActionLog("Cập nhật", string.Format("code: {0}; msg: {1}; id: {2}", code, msg, id)); } } catch (Exception ex) { ErrorBox.Message = "Lỗi chức năng"; NotifyBox.Message = string.Empty; SaveErrorLog(ex); } }
public EditFee() { AddSection() .IsFramed() .WithTitle("Edit Fee") .WithColumns(new List <Column> { new Column( new List <IField> { Map(x => x.Name) .AsSectionField <TextBox>() .Required() .WithLength(15), Map(x => x.FlatAmount) .AsSectionField <TextBox>() .Required() .TextFormatIs(TextFormat.numeric) .WithLength(15), Map(x => x.PercentageOfTransaction) .AsSectionField <TextBox>() .Required() .TextFormatIs(TextFormat.numeric), Map(x => x.Maximum) .AsSectionField <TextBox>() .Required() .TextFormatIs(TextFormat.numeric) .WithLength(15), Map(x => x.Minimum) .AsSectionField <TextBox>() .Required() .TextFormatIs(TextFormat.numeric) }), }) .WithFields(new List <IField> { AddSectionButton() .SubmitTo(f => { try { bool result = new FeeManager().EditFee(f); return(true); } catch (Exception ex) { message = ex.Message;; throw; } }) .ConfirmWith(s => String.Format("Update Fee {0} ", s.Name)).WithText("Update") .OnSuccessDisplay(s => String.Format("Update Fee {0} has been updated ", s.Name)) .OnFailureDisplay(s => String.Format("Error: Fee{0} was not updated ", message)) }); }
public AddFee() { string message = ""; WithTitle("Add Fee"); AddSection() .WithTitle("Fee Information") //.StretchFields(30).IsFramed() .IsCollapsible() .WithFields(new List <IField>() { Map(x => x.Name) .AsSectionField <TextBox>() .Required() .WithLength(15), Map(x => x.FlatAmount) .AsSectionField <TextBox>() .Required() .TextFormatIs(TextFormat.numeric) .WithLength(15), Map(x => x.PercentageOfTransaction) .AsSectionField <TextBox>() .Required() .TextFormatIs(TextFormat.numeric), Map(x => x.Maximum) .AsSectionField <TextBox>() .Required() .TextFormatIs(TextFormat.numeric) .WithLength(15), Map(x => x.Minimum) .AsSectionField <TextBox>() .Required() .TextFormatIs(TextFormat.numeric) }); AddButton().WithText("Save") .SubmitTo(fee => { try { bool result = new FeeManager().CreateFee(fee); return(result); } catch (Exception ex) { message = ex.Message; throw; } }) .OnSuccessDisplay("Successfully Saved") .OnFailureDisplay(string.Format("Sorry!!! Fee Not Saved", message)) .CssClassIs("btn btn-default"); }
private void SaveData() { try { if (Request.QueryString["id"] != null) { int id = int.Parse(Request.QueryString["id"].ToString()); int code = -1; string msg = ""; FeeManager feeManager = new FeeManager(); FeeBase fee = new FeeBase(); fee.FeeId = id; fee.FeeTypeId = int.Parse(ddlFeeType.SelectedValue); fee.Amount = decimal.Parse(txtAmount.Text.Trim().Replace(",", "")); fee.UserName = txtUserName.Text.Trim(); fee.Note = txtNote.Text.Trim(); fee.FeeStatus = int.Parse(ddlFeeStatus.SelectedValue); fee.UpdateDate = DateTime.Now; fee.UpdateUser = User.Identity.Name; feeManager.Fee_Update(fee, ref code, ref msg); if (code == 0) { ErrorBox.Message = string.Empty; NotifyBox.Message = "Lưu dữ liệu thành công"; } else { ErrorBox.Message = "Lưu dữ liệu thất bại"; NotifyBox.Message = string.Empty; } SaveActionLog("Cập nhật", string.Format("code: {0}; msg: {1}; id: {2}", code, msg, id)); } else { ErrorBox.Message = "Không lấy được dữ liệu"; NotifyBox.Message = string.Empty; } } catch (Exception ex) { ErrorBox.Message = "Lỗi chức năng"; NotifyBox.Message = string.Empty; SaveErrorLog(ex); } }
private void LoadData(int pageNumber, bool isExcel) { try { lblFeeTypeStatus.Visible = false; ddlFeeTypeStatus.Visible = false; btnAdd.Text = "Thêm mới"; btnAdd.CommandName = "Add"; FeeManager feeManager = new FeeManager(); int rowsPerPage, rowTotal; string feeTypeName; feeTypeName = txtFeeTypeName.Text.Trim(); rowsPerPage = 30; rowTotal = feeManager.FeeType_RowTotal(feeTypeName); if (rowTotal > 0) { rowsPerPage = isExcel ? rowTotal : rowsPerPage; uctPager.SetPageNumber(rowTotal, rowsPerPage, pageNumber); DataTable dt = feeManager.FeeType_Search(feeTypeName, rowsPerPage, pageNumber); gvData.DataSource = dt; gvData.DataBind(); divData.Visible = true; ErrorBox.Message = string.Empty; } else { divData.Visible = false; ErrorBox.Message = "Không có dữ liệu"; } } catch (Exception ex) { divData.Visible = false; ErrorBox.Message = "Lỗi chức năng"; SaveErrorLog(ex); } }
protected void gvData_RowDataBound(object sender, GridViewRowEventArgs e) { Format format = new Format(); FeeManager feeManager = new FeeManager(); if (e.Row.RowType == DataControlRowType.Header) { for (int i = 0; i < e.Row.Cells.Count; i++) { e.Row.Cells[i].Text = format.RenameFeeTitle(e.Row.Cells[i].Text); } } if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[1].Text = DateTime.Parse(e.Row.Cells[1].Text).ToString("dd/MM/yyyy"); e.Row.Cells[2].Text = feeManager.FeeType_GetName(int.Parse(e.Row.Cells[2].Text)); e.Row.Cells[3].HorizontalAlign = HorizontalAlign.Right; e.Row.Cells[3].Text = decimal.Parse(e.Row.Cells[3].Text).ToString("#,##0"); } }
private void SaveData() { try { int code = -1; string msg = ""; FeeManager feeManager = new FeeManager(); FeeBase fee = new FeeBase(); fee.FeeTypeId = int.Parse(ddlFeeType.SelectedValue); fee.Amount = decimal.Parse(txtAmount.Text.Trim().Replace(",", "")); fee.UserName = txtUserName.Text.Trim(); fee.Note = txtNote.Text.Trim(); fee.FeeStatus = int.Parse(ddlFeeStatus.SelectedValue); fee.CreateDate = DateTime.Now; fee.CreateUser = User.Identity.Name; feeManager.Fee_Insert(fee, ref code, ref msg); if (code == 0) { ErrorBox.Message = string.Empty; NotifyBox.Message = "Lưu dữ liệu thành công"; } else { ErrorBox.Message = "Lưu dữ liệu thất bại"; NotifyBox.Message = string.Empty; } SaveActionLog("Thêm mới", string.Format("code: {0}; msg: {1}", code, msg)); } catch (Exception ex) { ErrorBox.Message = "Lỗi chức năng"; NotifyBox.Message = string.Empty; SaveErrorLog(ex); } }
private void LoadData() { try { if (Request.QueryString["id"] != null) { FeeManager feeManager = new FeeManager(); int feeId = int.Parse(Request.QueryString["id"].ToString()); DataTable dt = new DataTable(); dt = feeManager.Fee_GetList(feeId); if (dt != null && dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; ddlFeeType.SelectedValue = dr["FeeTypeId"].ToString(); txtAmount.Text = decimal.Parse(dr["Amount"].ToString()).ToString("#,##0"); txtUserName.Text = dr["UserName"].ToString(); txtNote.Text = dr["Note"].ToString(); ddlFeeStatus.SelectedValue = dr["FeeStatus"].ToString(); } else { ErrorBox.Message = "Không có dữ liệu"; NotifyBox.Message = string.Empty; } } else { ErrorBox.Message = "Không lấy được dữ liệu"; NotifyBox.Message = string.Empty; } } catch (Exception ex) { ErrorBox.Message = "Lỗi chức năng"; NotifyBox.Message = string.Empty; SaveErrorLog(ex); } }
private void LoadData(int pageNumber, bool isExcel) { try { FeeManager feeManager = new FeeManager(); DateTime fromDate, toDate; int feeTypeId, rowsPerPage, rowTotal; fromDate = DateParse(txtFromDate.Text.Trim()); toDate = DateParse(txtToDate.Text.Trim()); feeTypeId = int.Parse(ddlFeeType.SelectedValue); rowsPerPage = 30; rowTotal = feeManager.Fee_RowTotal(fromDate, toDate, feeTypeId); if (rowTotal > 0) { rowsPerPage = isExcel ? rowTotal : rowsPerPage; uctPager.SetPageNumber(rowTotal, rowsPerPage, pageNumber); DataTable dt = feeManager.Fee_Search(fromDate, toDate, feeTypeId, rowsPerPage, pageNumber); gvData.DataSource = dt; gvData.DataBind(); divData.Visible = true; ErrorBox.Message = string.Empty; } else { divData.Visible = false; ErrorBox.Message = "Không có dữ liệu"; } } catch (Exception ex) { divData.Visible = false; ErrorBox.Message = "Lỗi chức năng"; SaveErrorLog(ex); } }
public FeeServices() { _feeManager = new FeeManager(); }