Example #1
0
        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;
            }
        }
Example #2
0
 private void InsertPCCDetails()
 {
     if (cmdSubmit.CommandName.ToLower() == "SAVE".ToLower())
     {
         core_petty_cash_category         pccObj = new core_petty_cash_category();
         core_petty_cash_category_Objects ObjPCC = new core_petty_cash_category_Objects();
         ObjPCC.Petty_Cash_Category_Name = PCC_Name.Text;
         ObjPCC.Petty_Cash_Category_Code = PCC_Code.Text;
         ObjPCC.Id_Ledger_Account        = Convert.ToInt32(ddlLedgerAccountType.SelectedValue);
         ObjPCC.Created_Date             = DateTime.Now;
         pccObj.Insert(ObjPCC);
         ScriptManager.RegisterStartupScript(this, GetType(), "insert", "showAlert('success');", true);
     }
     if (cmdSubmit.CommandName.ToLower() == "UPDATE".ToLower())
     {
         if (!((HiddenField1.Value) == null || (HiddenField1.Value) == ""))
         {
             var sc = new core_petty_cash_category();//System.Net.WebUtility.HtmlEncode()
             sc.UpdateMethod(@"UPDATE `core_petty_cash_category`
                                 SET
                                 `Petty_Cash_Category_Name` = '" + PCC_Name.Text.Trim().Replace("'", "''") + @"',
                                 `Petty_Cash_Category_Code` = '" + PCC_Code.Text.Trim().Replace("'", "''") + @"',
                                 `Id_Ledger_Account` = '" + Convert.ToInt32(ddlLedgerAccountType.SelectedValue) + @"',                                                                              
                                 `Edited_Date` = now()
                                 WHERE `Id_Petty_Cash_Category` = '" + Convert.ToInt32(HiddenField1.Value) + @"';");
             ScriptManager.RegisterStartupScript(this, GetType(), "update", "showAlert('success');", true);
         }
     }
     this.ClearFeilds();
     loadGrid();
 }
Example #3
0
        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();
            }
        }
Example #4
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("Delete"))
            {
                try
                {
                    LinkButton  LB    = (LinkButton)e.CommandSource;
                    GridView    GV    = (GridView)sender;
                    GridViewRow GVRow = (GridViewRow)LB.Parent.Parent;
                    string      PCCid = GV.DataKeys[GVRow.RowIndex]["Id_Petty_Cash_Category"].ToString();
                    HiddenField1.Value = PCCid.ToString();

                    core_petty_cash_category PCC = new core_petty_cash_category();
                    PCC.UpdateMethod(@"UPDATE `core_petty_cash_category`
                                        SET
                                        `Is_Active` = 1,
                                        `Edited_Date` = now()
                WHERE `Id_Petty_Cash_Category` = '" + Convert.ToInt32(HiddenField1.Value) + @"';");
                    //PCC.UpdateMethod(@"UPDATE core_petty_cash_category SET Is_Active='1',Edited_date=now() WHERE Id_Petty_Cash_Category='" + Convert.ToString(HiddenField1.Value) + @"';");
                    ScriptManager.RegisterStartupScript(this, GetType(), "delete", "showAlert('success');", true);
                    this.ClearFeilds();
                    this.loadDDL();
                }
                catch (Exception ex)
                {
                    Exception E = ex;
                }
            }
        }
        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();
        }