protected void cvPCB_Code_ServerValidate(object source, ServerValidateEventArgs args) { try { if (cmdSubmit.CommandName.ToLower() == "SAVE".ToLower()) { DataView dv; core_petty_cash_category pccObj = new core_petty_cash_category(); //DataSet dataSet11 = new DataSet(); DataSet ds = pccObj.SelectMethod(@"SELECT PCB.Petty_Cash_Book_Code FROM core_petty_cash_book AS PCB WHERE PCB.Is_Active='0';", "core_petty_cash_book"); dv = ds.Tables["core_petty_cash_book"].DefaultView; string pcbc; args.IsValid = true; // Loop through table and compare each record against user's entry foreach (DataRowView datarow in dv) { // Extract e-mail address from the current row //txtEmail = datarow["Alias "].ToString(); pcbc = datarow["Petty_Cash_Book_Code"].ToString(); // Compare e-mail address against user's entry if (pcbc == args.Value) { args.IsValid = false; } } } } catch (Exception) { throw; } }
private void loadLedgerAccountDetails() { core_petty_cash_category pccObj = new core_petty_cash_category(); DataSet ds = pccObj.SelectMethod(@"SELECT pcc.Id_Petty_Cash_Category, la.Id_Ledger_Account, la.Ledger_Account_Name, la.Balance_Carried_Forward FROM core_petty_cash_category AS pcc INNER JOIN core_ledger_account AS la ON la.Id_Ledger_Account=pcc.Id_Ledger_Account WHERE pcc.Is_Active='0' AND pcc.Id_Petty_Cash_Category='" + ddlPCCName.SelectedValue + "' OR pcc.Id_Petty_Cash_Category='" + ddlPCCCode.SelectedValue + "';", "core_petty_cash_category"); if (ds.Tables["core_petty_cash_category"] != null && ds.Tables["core_petty_cash_category"].Rows.Count > 0) { hfIDLedgerAccount.Value = ds.Tables["core_petty_cash_category"].Rows[0]["Id_Ledger_Account"].ToString(); hfIDLedgerAccountBCF.Value = ds.Tables["core_petty_cash_category"].Rows[0]["Balance_Carried_Forward"].ToString(); } }
private void loadPCCDDL() { core_petty_cash_category objPCB=new core_petty_cash_category(); DataSet ds = objPCB.SelectMethod(@"SELECT PCC.Id_Petty_Cash_Category,PCC.Petty_Cash_Category_Name,PCC.Petty_Cash_Category_Code FROM core_petty_cash_category AS PCC WHERE PCC.Is_Active='0';", "core_petty_cash_category"); DataRow dr = ds.Tables["core_petty_cash_category"].NewRow(); dr[0] = "0"; dr[1] = "Select"; dr[2] = "Select"; ds.Tables["core_petty_cash_category"].Rows.InsertAt(dr, 0); ddlPCCName.DataSource=ds.Tables["core_petty_cash_category"]; ddlPCCName.DataValueField = "Id_Petty_Cash_Category"; ddlPCCName.DataTextField = "Petty_Cash_Category_Name"; ddlPCCName.DataBind(); ddlPCCCode.DataSource = ds.Tables["core_petty_cash_category"]; ddlPCCCode.DataValueField = "Id_Petty_Cash_Category"; ddlPCCCode.DataTextField = "Petty_Cash_Category_Code"; ddlPCCCode.DataBind(); }
private void loadGrid() { core_petty_cash_category pccObj=new core_petty_cash_category(); DataSet ds=pccObj.SelectMethod(@"SELECT PCC.Id_Petty_Cash_Category, PCC.Id_Ledger_Account, LA.Ledger_Account_Name, PCC.Petty_Cash_Category_Name, PCC.Petty_Cash_Category_Code, PCC.Created_Date, PCC.Created_User, PCC.Edited_Date, PCC.Edited_User, PCC.Is_Active FROM core_petty_cash_category AS PCC INNER JOIN core_ledger_account AS LA ON PCC.Id_Ledger_Account=LA.Id_Ledger_Account WHERE PCC.Is_Active='0';", "core_petty_cash_category"); if(ds.Tables["core_petty_cash_category"] != null) { GridView1.DataSource=ds.Tables["core_petty_cash_category"]; GridView1.DataBind(); } else { GridView1.DataSource=new int[]{}; GridView1.DataBind(); } }