private void LoadOptions() { AccountCategories clsAccountCategory = new AccountCategories(); DataClass clsDataClass = new DataClass(); cboAccountCategory.DataTextField = "AccountCategoryName"; cboAccountCategory.DataValueField = "AccountCategoryID"; cboAccountCategory.DataSource = clsDataClass.DataReaderToDataTable(clsAccountCategory.List("AccountCategoryName",SortOption.Ascending)).DefaultView; cboAccountCategory.DataBind(); cboAccountCategory.SelectedIndex = cboAccountCategory.Items.Count - 1; clsAccountCategory.CommitAndDispose(); }
private void LoadRecord() { Int32 iID = Convert.ToInt32(Common.Decrypt(Request.QueryString["id"],Session.SessionID)); AccountCategories clsAccountCategory = new AccountCategories(); AccountCategoryDetails clsDetails = clsAccountCategory.Details(iID); clsAccountCategory.CommitAndDispose(); lblAccountCategoryID.Text = clsDetails.AccountCategoryID.ToString(); cboAccountSummary.SelectedIndex = cboAccountSummary.Items.IndexOf( cboAccountSummary.Items.FindByValue(clsDetails.AccountSummaryDetails.AccountSummaryID.ToString())); txtAccountCategoryCode.Text = clsDetails.AccountCategoryCode; txtAccountCategoryName.Text = clsDetails.AccountCategoryName; }
private void LoadAccountCategoryList(DataList lstAccountCategory, int AccountSummaryID) { AccountCategories clsAccountCategory = new AccountCategories(); DataClass clsDataClass = new DataClass(); System.Data.DataTable dt = clsDataClass.DataReaderToDataTable(clsAccountCategory.List(AccountSummaryID, "AccountCategoryCode", SortOption.Ascending)); clsAccountCategory.CommitAndDispose(); lstAccountCategory.DataSource = dt.DefaultView; lstAccountCategory.DataBind(); }
private bool Delete() { bool boRetValue = false; string stIDs = ""; foreach(DataListItem item in lstAccountSummary.Items) { DataList lstAccountCategory = (DataList)item.FindControl("lstAccountCategory"); foreach (DataListItem itemAccountCategory in lstAccountCategory.Items) { HtmlInputCheckBox chkList = (HtmlInputCheckBox)itemAccountCategory.FindControl("chkList"); if (chkList != null) { if (chkList.Checked == true) { stIDs += chkList.Value + ","; boRetValue = true; } } } } if (boRetValue) { AccountCategories clsAccountCategory = new AccountCategories(); clsAccountCategory.Delete( stIDs.Substring(0,stIDs.Length-1)); clsAccountCategory.CommitAndDispose(); } return boRetValue; }
private void SaveRecord() { AccountCategoryDetails clsDetails = new AccountCategoryDetails(); clsDetails.AccountCategoryID = Convert.ToInt16(lblAccountCategoryID.Text); clsDetails.AccountSummaryDetails = new AccountSummaryDetails { AccountSummaryID = Convert.ToInt32(cboAccountSummary.SelectedItem.Value) }; clsDetails.AccountCategoryCode = txtAccountCategoryCode.Text; clsDetails.AccountCategoryName = txtAccountCategoryName.Text; AccountCategories clsAccountCategory = new AccountCategories(); clsAccountCategory.Update(clsDetails); clsAccountCategory.CommitAndDispose(); }
private Int32 SaveRecord() { AccountCategoryDetails clsDetails = new AccountCategoryDetails(); clsDetails.AccountSummaryDetails = new AccountSummaryDetails { AccountSummaryID = Convert.ToInt32(cboAccountSummary.SelectedItem.Value) }; clsDetails.AccountCategoryCode = txtAccountCategoryCode.Text; clsDetails.AccountCategoryName = txtAccountCategoryName.Text; AccountCategories clsAccountCategory = new AccountCategories(); Int32 id = clsAccountCategory.Insert(clsDetails); clsAccountCategory.CommitAndDispose(); return id; }
public ChartOfAccountDetails Details(Int32 ChartOfAccountID) { try { string SQL = SQLSelect() + "WHERE ChartOfAccountID = @ChartOfAccountID;"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; MySqlParameter prmChartOfAccountID = new MySqlParameter("@ChartOfAccountID",MySqlDbType.Int16); prmChartOfAccountID.Value = ChartOfAccountID; cmd.Parameters.Add(prmChartOfAccountID); System.Data.DataTable dt = new System.Data.DataTable("ChartOfAccount"); MySqlDataAdapter adapter = new MySqlDataAdapter(cmd); adapter.Fill(dt); ChartOfAccountDetails Details = new ChartOfAccountDetails(); AccountCategories clsAccountCategory = new AccountCategories(this.Connection, this.Transaction); AccountSummaries clsAccountSummary = new AccountSummaries(this.Connection, this.Transaction); AccountClassifications clsAccountClassification = new AccountClassifications(this.Connection, this.Transaction); foreach(System.Data.DataRow dr in dt.Rows) { Details.ChartOfAccountID = ChartOfAccountID; Details.ChartOfAccountCode = "" + dr["ChartOfAccountCode"].ToString(); Details.ChartOfAccountName = "" + dr["ChartOfAccountName"].ToString(); Details.Debit = decimal.Parse(dr["Debit"].ToString()); Details.Credit = decimal.Parse(dr["Credit"].ToString()); Details.AccountCategoryDetails = clsAccountCategory.Details(Int32.Parse(dr["AccountCategoryID"].ToString())); //Details.AccountSummaryDetails = clsAccountSummary.Details(Int32.Parse(dr["AccountSummaryID"].ToString())); //Details.AccountClassificationDetails = clsAccountClassification.Details(Int16.Parse(dr["AccountClassificationID"].ToString())); } return Details; } catch (Exception ex) { { } throw base.ThrowException(ex); } }