protected void save() { #region Variables SubcidiaryAccount.sub_code = txtcode.Text; SubcidiaryAccount.sub_title = txtTitle.Text; SubcidiaryAccount.sub_category_id = cboLedgerCategory.SelectedValue.ToString(); SubcidiaryAccount.sub_opening_bal = txtOpeningBal.Text != string.Empty.Trim() ? decimal.Parse(txtOpeningBal.Text.Trim()) : 0; SubcidiaryAccount.nominal_acc_id = cboNorminalAcc.SelectedValue.ToString(); SubcidiaryAccount.debit_credit = cboDebitCredit.Text; SubcidiaryAccount.active = chkActive.Checked ? true : false; SubcidiaryAccount.tel_contact = txtPhone.Text; SubcidiaryAccount.email_adress = txtEmail.Text; SubcidiaryAccount.adress = txtAddress.Text; SubcidiaryAccount.branch_id = cboBranch.SelectedValue.ToString(); SubcidiaryAccount.usr_id_create = SystemConst._user_id; SubcidiaryAccount.usr_id_update = SystemConst._user_id; SubcidiaryAccount.usr_date_create = DateTime.Now; SubcidiaryAccount.usr_date_update = DateTime.Now; #endregion if (lblID.Text == Globals.EmptyID) { SubcidiaryAccount.sub_id = Guid.NewGuid().ToString(); lblID.Text = SubcidiaryAccount.sub_id; SubcidiaryAccount.save("save_record"); MessageBox.Show("Succefully saved new subsidiary account details", "save", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { SubcidiaryAccount.sub_id = lblID.Text; SubcidiaryAccount.save("update_record"); MessageBox.Show("Succefully updated subsidiary account details", "save", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
protected void LoadRecordDetails(string id) { dt = SubcidiaryAccount.LoadRecord("select_record_details", id); if (dt.Rows.Count > 0) { DataRow dtRow = dt.Rows[0]; txtcode.Text = dtRow["sub_code"].ToString(); txtTitle.Text = dtRow["sub_title"].ToString(); cboLedgerCategory.SelectedValue = dtRow["sub_category_id"].ToString(); txtOpeningBal.Text = decimal.Parse(dtRow["sub_opening_bal"].ToString()).ToString(); cboNorminalAcc.SelectedValue = dtRow["nominal_acc_id"].ToString(); cboDebitCredit.Text = dtRow["sub_category_id"].ToString(); chkActive.Checked = Convert.ToBoolean(dtRow["active"]); txtPhone.Text = dtRow["tel_contact"].ToString(); txtEmail.Text = dtRow["email_adress"].ToString(); txtAddress.Text = dtRow["adress"].ToString(); cboBranch.SelectedValue = dtRow["branch_id"].ToString(); lblID.Text = id; pnlDataEntry.Enabled = false; } }
protected void SearchGridviewListing() { dt = SubcidiaryAccount.LoadList("select_record_listing", txtCodeSearch.Text.Trim(), cboSubLedgerSearch.SelectedValue.ToString(), cboControlAccSearch.SelectedValue.ToString(), txtAccountTitle.Text.Trim()); if (dt != null) { gdvList.DataSource = dt; gdvList.Columns["sub_id"].Visible = false; gdvList.Columns["adress"].Visible = false; gdvList.Columns["sub_title"].HeaderText = "Account Title"; gdvList.Columns["sub_code"].HeaderText = "Account Code"; gdvList.Columns["sub_opening_bal"].HeaderText = "Opening Bal"; gdvList.Columns["debit_credit"].HeaderText = "Dr/Cr"; gdvList.Columns["sub_ledger_category_name"].HeaderText = "Sub Ledger"; gdvList.Columns["acc_name"].HeaderText = "Control Acc Title"; gdvList.Columns["active"].HeaderText = "Active"; gdvList.Columns["tel_contact"].HeaderText = "Phone Number"; gdvList.Columns["email_adress"].HeaderText = "Email Address"; gdvList.Columns["branch"].HeaderText = "Branch"; gdvList.RowsDefaultCellStyle.BackColor = Color.LightGray; gdvList.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige; gdvList.ColumnHeadersDefaultCellStyle.ForeColor = Color.White; gdvList.ColumnHeadersDefaultCellStyle.BackColor = Color.Black; gdvList.RowHeadersDefaultCellStyle.BackColor = Color.Black; gdvList.DefaultCellStyle.SelectionBackColor = Color.Cyan; gdvList.DefaultCellStyle.SelectionForeColor = Color.Black; foreach (DataGridViewColumn c in this.gdvList.Columns) { c.DefaultCellStyle.Font = new System.Drawing.Font("Arial", 12f, GraphicsUnit.Pixel); } this.gdvList.ColumnHeadersDefaultCellStyle.BackColor = Color.CadetBlue; this.gdvList.EnableHeadersVisualStyles = false; } }