public virtual CloudAccountDA.SubCategoryMasterDataTable GetDataByCategorySubCategoryNameUpdate(int?SubCategoryID, int?CategoryID, string SubCategoryName) { this.Adapter.SelectCommand = this.CommandCollection[3]; if (SubCategoryID.HasValue) { this.Adapter.SelectCommand.Parameters[1].Value = SubCategoryID.Value; } else { this.Adapter.SelectCommand.Parameters[1].Value = DBNull.Value; } if (CategoryID.HasValue) { this.Adapter.SelectCommand.Parameters[2].Value = CategoryID.Value; } else { this.Adapter.SelectCommand.Parameters[2].Value = DBNull.Value; } if (SubCategoryName == null) { this.Adapter.SelectCommand.Parameters[3].Value = DBNull.Value; } else { this.Adapter.SelectCommand.Parameters[3].Value = SubCategoryName; } CloudAccountDA.SubCategoryMasterDataTable dataTable = new CloudAccountDA.SubCategoryMasterDataTable(); this.Adapter.Fill(dataTable); return(dataTable); }
public virtual CloudAccountDA.SubCategoryMasterDataTable GetData() { this.Adapter.SelectCommand = this.CommandCollection[0]; CloudAccountDA.SubCategoryMasterDataTable dataTable = new CloudAccountDA.SubCategoryMasterDataTable(); this.Adapter.Fill(dataTable); return(dataTable); }
protected void btnUploadCsvExpence_OnClick(object sender, EventArgs e) { if (this.gvCsvExpence.Rows.Count <= 0) { return; } int num = 0; for (int index = 0; index < this.gvCsvExpence.Rows.Count; ++index) { CheckBox checkBox = (CheckBox)this.gvCsvExpence.Rows[index].FindControl("chk"); TextBox textBox1 = (TextBox)this.gvCsvExpence.Rows[index].FindControl("txtDate"); TextBox textBox2 = (TextBox)this.gvCsvExpence.Rows[index].FindControl("txtVendor"); TextBox textBox3 = (TextBox)this.gvCsvExpence.Rows[index].FindControl("txtNotes"); TextBox textBox4 = (TextBox)this.gvCsvExpence.Rows[index].FindControl("txtAmount"); DropDownList dropDownList = (DropDownList)this.gvCsvExpence.Rows[index].FindControl("ddlCategory"); if (checkBox.Checked && !string.IsNullOrEmpty(textBox1.Text.Trim()) && (!string.IsNullOrEmpty(textBox2.Text.Trim()) && !string.IsNullOrEmpty(textBox4.Text.Trim())) && dropDownList.SelectedIndex > 0) { int?iCategoryID = new int?(); int?iSubCategoryID = new int?(); this.objSubCategoryMasterDT = this.objSubCategoryMasterBll.GetDataBySubCategoryID(int.Parse(dropDownList.SelectedItem.Value)); if (this.objSubCategoryMasterDT.Rows.Count > 0) { iCategoryID = new int?(int.Parse(this.objSubCategoryMasterDT.Rows[0]["CategoryID"].ToString())); iSubCategoryID = new int?(int.Parse(this.objSubCategoryMasterDT.Rows[0]["SubCategoryID"].ToString())); } if (this.objExpenseMasterBll.AddExpense(int.Parse(this.hfCompanyID.Value), Decimal.Parse(textBox4.Text), new DateTime?(DateTime.Parse(textBox1.Text)), textBox2.Text, iCategoryID, iSubCategoryID, textBox3.Text, false, new int?(), new Decimal?(), new int?(), new Decimal?(), false, new int?(), (string)null, new DateTime?(), false, new int?(), false, (byte[])null, "", true, false, false) != 0) { ++num; } } } this.Session["importExp"] = (object)num; this.Response.Redirect("~/BillTransact/ExpenseMaster.aspx"); }
public virtual int Fill(CloudAccountDA.SubCategoryMasterDataTable dataTable) { this.Adapter.SelectCommand = this.CommandCollection[0]; if (this.ClearBeforeFill) { dataTable.Clear(); } return(this.Adapter.Fill(dataTable)); }
private void SetRecord(string iD) { this.objSubCategoryMasterDT = this.objSubCategoryMasterBll.GetDataBySubCategoryID(int.Parse(iD)); if (this.objSubCategoryMasterDT.Rows.Count <= 0) { return; } this.hfSubCategory.Value = this.objSubCategoryMasterDT.Rows[0]["SubCategoryID"].ToString(); this.ddlCategory.SelectedValue = this.objSubCategoryMasterDT.Rows[0]["CategoryID"].ToString(); this.txtCode.Text = this.objSubCategoryMasterDT.Rows[0]["SubCategoryCode"].ToString(); this.txtName.Text = this.objSubCategoryMasterDT.Rows[0]["SubCategoryName"].ToString(); this.txtDesc.Text = this.objSubCategoryMasterDT.Rows[0]["SubCategoryDesc"].ToString(); this.chkStatus.Checked = this.objSubCategoryMasterDT.Rows[0]["SubCategoryStatus"].ToString() == "True"; }
private void ViewRecord(string i) { this.objSubCategoryMasterDT = this.objSubCategoryMasterBll.GetDataBySubCategoryID(int.Parse(i)); if (this.objSubCategoryMasterDT.Rows.Count <= 0) { return; } this.hfSubCategory.Value = this.objSubCategoryMasterDT.Rows[0]["SubCategoryID"].ToString(); this.lblCode.Text = this.objSubCategoryMasterDT.Rows[0]["SubCategoryCode"].ToString(); this.lblName.Text = this.objSubCategoryMasterDT.Rows[0]["SubCategoryName"].ToString(); this.lblDesc.Text = this.objSubCategoryMasterDT.Rows[0]["SubCategoryDesc"].ToString(); this.lblStatus.Text = this.objSubCategoryMasterDT.Rows[0]["SubCategoryStatus"].ToString() == "True" ? "True" : "False"; this.objCategoryMasterDT = this.objCategoryMasterBll.GetDataByCategoryID(int.Parse(this.objSubCategoryMasterDT.Rows[0]["CategoryID"].ToString())); this.lblCategory.Text = this.objCategoryMasterDT.Rows[0]["CategoryName"].ToString(); }
public virtual CloudAccountDA.SubCategoryMasterDataTable GetDataByCategoryID(int?CategoryID) { this.Adapter.SelectCommand = this.CommandCollection[1]; if (CategoryID.HasValue) { this.Adapter.SelectCommand.Parameters[1].Value = CategoryID.Value; } else { this.Adapter.SelectCommand.Parameters[1].Value = DBNull.Value; } CloudAccountDA.SubCategoryMasterDataTable dataTable = new CloudAccountDA.SubCategoryMasterDataTable(); this.Adapter.Fill(dataTable); return(dataTable); }
public virtual CloudAccountDA.SubCategoryMasterDataTable GetDataBySubCategoryName(string SubCategoryName) { this.Adapter.SelectCommand = this.CommandCollection[5]; if (SubCategoryName == null) { this.Adapter.SelectCommand.Parameters[1].Value = DBNull.Value; } else { this.Adapter.SelectCommand.Parameters[1].Value = SubCategoryName; } CloudAccountDA.SubCategoryMasterDataTable dataTable = new CloudAccountDA.SubCategoryMasterDataTable(); this.Adapter.Fill(dataTable); return(dataTable); }
protected void btnUpdate_Click(object sender, EventArgs e) { try { if (this.Page.IsValid) { if (this.ddlCategory.SelectedIndex > 0 && this.txtCode.Text.Trim().Length > 0 && this.txtName.Text.Trim().Length > 0) { this.objSubCategoryMasterDT = this.objSubCategoryMasterBll.GetDataByCategorySubCategoryName(int.Parse(this.hfSubCategory.Value.Trim()), int.Parse(this.ddlCategory.SelectedItem.Value), this.txtName.Text); if (this.objSubCategoryMasterDT.Rows.Count > 0) { this.DisplayAlert("SubCategory is Already Exist in Category..."); this.checkInDB = true; } else { this.checkInDB = false; } if (this.checkInDB) { return; } if (this.objSubCategoryMasterBll.UpdateSubCategory(int.Parse(this.hfSubCategory.Value.Trim()), int.Parse(this.ddlCategory.SelectedItem.Value), this.txtCode.Text.Trim(), this.txtName.Text.Trim(), this.txtDesc.Text.Trim(), this.chkStatus.Checked)) { this.DisplayAlert("Update Successfully.."); this.Response.Redirect("~/BillTransact/SubCategoryMaster.aspx?cmd=view&ID=" + this.Request.QueryString["ID"]); } else { this.DisplayAlert("Fail to Update Details."); } } else { this.DisplayAlert("Please Fill All Data...!"); } } else { this.DisplayAlert("Fail to Update Details."); } } catch (Exception ex) { this.DisplayAlert(ex.Message); } }
protected void btnDelete_Click(object sender, EventArgs e) { this.objSubCategoryMasterDT = this.objSubCategoryMasterBll.GetDataByCategoryID(int.Parse(this.hfCategory.Value)); if (this.objSubCategoryMasterDT.Rows.Count > 0) { this.DisplayAlert("Child Data Exist.."); } else if (this.hfCategory.Value != null) { if (this.objCategoryMasterBll.DeleteCategory(int.Parse(this.hfCategory.Value))) { this.DisplayAlert("Details has been Deleted"); this.Response.Redirect("~/BillTransact/CategoryMaster.aspx"); } else { this.DisplayAlert("Error In Deleting Detail"); } } else { this.DisplayAlert("Error In Deleting Detail"); } }
public virtual int Update(CloudAccountDA.SubCategoryMasterDataTable dataTable) { return(this.Adapter.Update(dataTable)); }
protected void gvCsvExpence_OnRowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType != DataControlRowType.DataRow) { return; } TextBox textBox1 = (TextBox)e.Row.FindControl("txtDate"); TextBox textBox2 = (TextBox)e.Row.FindControl("txtVendor"); TextBox textBox3 = (TextBox)e.Row.FindControl("txtNotes"); TextBox textBox4 = (TextBox)e.Row.FindControl("txtAmount"); DropDownList dropDownList = (DropDownList)e.Row.FindControl("ddlCategory"); SqlDataSource sqlDataSource = (SqlDataSource)e.Row.FindControl("sqldsCategory"); DataRowView dataRowView = (DataRowView)e.Row.DataItem; string columnNameToCheck = "Vendor"; if (Enumerable.Any <DataColumn>(Enumerable.Cast <DataColumn>((IEnumerable)dataRowView.Row.Table.Columns), (Func <DataColumn, bool>)(x => x.ColumnName.Equals(columnNameToCheck, StringComparison.InvariantCultureIgnoreCase)))) { textBox2.Text = DataBinder.Eval(e.Row.DataItem, "Vendor").ToString(); } columnNameToCheck = "Notes"; if (Enumerable.Any <DataColumn>(Enumerable.Cast <DataColumn>((IEnumerable)dataRowView.Row.Table.Columns), (Func <DataColumn, bool>)(x => x.ColumnName.Equals(columnNameToCheck, StringComparison.InvariantCultureIgnoreCase)))) { textBox3.Text = DataBinder.Eval(e.Row.DataItem, "Notes").ToString(); } columnNameToCheck = "Amount"; if (Enumerable.Any <DataColumn>(Enumerable.Cast <DataColumn>((IEnumerable)dataRowView.Row.Table.Columns), (Func <DataColumn, bool>)(x => x.ColumnName.Equals(columnNameToCheck, StringComparison.InvariantCultureIgnoreCase)))) { Decimal num = Decimal.Parse(DataBinder.Eval(e.Row.DataItem, "Amount").ToString()); if (num >= new Decimal(0) && this.ddlAmountFormat.SelectedItem.Value == "+") { e.Row.Visible = true; } else if (num < new Decimal(0) && this.ddlAmountFormat.SelectedItem.Value == "-") { e.Row.Visible = true; } else { e.Row.Visible = false; } textBox4.Text = Math.Abs(num).ToString(); } columnNameToCheck = "Category"; if (Enumerable.Any <DataColumn>(Enumerable.Cast <DataColumn>((IEnumerable)dataRowView.Row.Table.Columns), (Func <DataColumn, bool>)(x => x.ColumnName.Equals(columnNameToCheck, StringComparison.InvariantCultureIgnoreCase)))) { string str = DataBinder.Eval(e.Row.DataItem, "Category").ToString(); this.objSubCategoryMasterDT = this.objSubCategoryMasterBll.GetDataBySubCategoryName(str); if (this.objSubCategoryMasterDT.Rows.Count > 0) { dropDownList.SelectedValue = this.objSubCategoryMasterDT.Rows[0]["SubCategoryID"].ToString(); } else { this.objCategoryMasterDT = this.objCategoryMasterBll.GetDataByCategoryName("Other Expenses"); int num = this.objCategoryMasterDT.Rows.Count <= 0 ? this.objSubCategoryMasterBll.AddSubCategory(this.objCategoryMasterBll.AddCategory("", "Other Expenses", "Other Expenses", true), "", str, str, true) : this.objSubCategoryMasterBll.AddSubCategory(int.Parse(this.objCategoryMasterDT.Rows[0]["CategoryID"].ToString()), "", str, str, true); sqlDataSource.DataBind(); dropDownList.DataBind(); dropDownList.SelectedValue = num.ToString(); } } columnNameToCheck = "Date"; if (!Enumerable.Any <DataColumn>(Enumerable.Cast <DataColumn>((IEnumerable)dataRowView.Row.Table.Columns), (Func <DataColumn, bool>)(x => x.ColumnName.Equals(columnNameToCheck, StringComparison.InvariantCultureIgnoreCase)))) { return; } try { textBox1.Text = DataBinder.Eval(e.Row.DataItem, "Date").ToString(); string[] formats = new string[18] { "MM/dd/yy", "MM/dd/yyyy", "MMM/dd/yy", "MMM/dd/yyyy", "MMMM/dd/yy", "MMMM/dd/yyyy", "dd/MM/yy", "dd/MM/yyyy", "dd/MMM/yy", "dd/MMM/yyyy", "dd/MMMM/yy", "dd/MMMM/yyyy", "yy-MM-dd", "yyyy-MM-dd", "yy-MMM-dd", "yyyy-MMM-dd", "yy-MMMM-dd", "yyyy-MMMM-dd" }; textBox1.Text = DateTime.ParseExact(textBox1.Text, formats, (IFormatProvider)CultureInfo.InvariantCulture, DateTimeStyles.None).ToString("MM/dd/yyyy"); } catch (Exception ex) { this.lblError.Text = "Expence date format / date is not valid please correct the format / date and re-upload that file or upload new file."; this.divError.Visible = true; } }