예제 #1
0
        private void InsertPCBDetails()
        {
            if (cmdSubmit.CommandName.ToLower() == "SAVE".ToLower())
            {
                core_petty_cash_book         pcbObj = new core_petty_cash_book();
                core_petty_cash_book_Objects ObjPCB = new core_petty_cash_book_Objects();
                ObjPCB.Petty_Cash_Book_Name       = PCB_Name.Text;
                ObjPCB.Petty_Cash_Book_Code       = PCB_Code.Text;
                ObjPCB.Petty_Cash_Book_Max_Amount = Convert.ToDouble(PCB_Max_Amount.Text);
                ObjPCB.Available_Balance_Amount   = Convert.ToDouble(hfAvailableBalance.Value);
                ObjPCB.Petty_Cash_Book_Remark     = PCB_Remark.Text;
                ObjPCB.Created_Date = DateTime.Today;

                //ObjPCB.Created_Date = Convert.ToDateTime(DateTime.Now.Date.ToString("yyyy-MM-dd"));
                //txtTrDate.Text = string.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(DateTime.Now.Date));

                pcbObj.Insert(ObjPCB);
                //ScriptManager.RegisterStartupScript(this, GetType(), "AlertSweet", "alertSweet1();", true);
                ScriptManager.RegisterStartupScript(this, GetType(), "insert", "showAlert('success');", true);
            }
            if (cmdSubmit.CommandName.ToLower() == "UPDATE".ToLower())
            {
                if (!((HiddenField1.Value) == null || (HiddenField1.Value) == ""))
                {
                    //ScriptManager.RegisterStartupScript(this, GetType(), "updateConfirm", "alertSweet1();", true);
                    var sc = new core_petty_cash_book();//System.Net.WebUtility.HtmlEncode()
                    sc.UpdateMethod(@"UPDATE `core_petty_cash_book`
                                        SET                                        
                                        `Petty_Cash_Book_Name` = '" + PCB_Name.Text.Trim().Replace("'", "''") + @"',
                                        `Petty_Cash_Book_Code` = '" + PCB_Code.Text.Trim().Replace("'", "''") + @"',
                                        `Petty_Cash_Book_Max_Amount` = '" + Convert.ToDouble(PCB_Max_Amount.Text) + @"',
                                        `Available_Balance_Amount` = '" + Convert.ToDouble(PCB_Available_Balance_Amount.Text) + @"',
                                        `Petty_Cash_Book_Remark` = '" + PCB_Remark.Text.Trim().Replace("'", "''") + @"',
                                        `Edited_Date` = now()
                                        WHERE `Id_Petty_Cash_Book` = '" + Convert.ToInt32(HiddenField1.Value) + @"';
                                        ");
                    //ScriptManager.RegisterStartupScript(this, GetType(), "AlertSweet", "alertSweet4();", true);
                    ScriptManager.RegisterStartupScript(this, GetType(), "update", "showAlert('success');", true);
                    cmdSubmit.CommandName = "SAVE";
                    cmdSubmit.Text        = "Save";
                }
            }
            ClearFeilds();
            RetrievePCBDetails();
        }
예제 #2
0
        private void RetrievePCBDetails()
        {
            core_petty_cash_book         pcbObj = new core_petty_cash_book();
            core_petty_cash_book_Objects ObjPCB = new core_petty_cash_book_Objects();
            DataSet ds = pcbObj.SelectMethod(@"SELECT  
PCB.Id_Petty_Cash_Book,
PCB.Petty_Cash_Book_Name, 
PCB.Petty_Cash_Book_Code, 
PCB.Petty_Cash_Book_Max_Amount, 
PCB.Available_Balance_Amount, 
PCB.Petty_Cash_Book_Remark,
PCB.Created_Date, 
PCB.Created_User, 
PCB.Edited_Date, 
PCB.Edited_User, 
PCB.Is_Active
FROM core_petty_cash_book as PCB WHERE PCB.Is_Active='0';", "core_petty_cash_book");

            GridView1.DataSource = ds.Tables["core_petty_cash_book"];
            GridView1.DataBind();
        }
예제 #3
0
        /// <summary>
        /// Saves a record to the core_petty_cash_book table.
        /// </summary>
        public void Insert(core_petty_cash_book_Objects objCls)
        {
            MySqlConnection scon = Connectivity.Cls_Connection.getConnection();
            MySqlCommand    scom = new MySqlCommand("core_petty_cash_bookInsert", scon);

            scom.CommandType = CommandType.StoredProcedure;


            scom.Parameters.Add("COL_Id_Petty_Cash_Book", MySqlDbType.Int32, 0);
            scom.Parameters.Add("COL_Petty_Cash_Book_Name", MySqlDbType.VarChar, 45);
            scom.Parameters.Add("COL_Petty_Cash_Book_Code", MySqlDbType.VarChar, 45);
            scom.Parameters.Add("COL_Petty_Cash_Book_Max_Amount", MySqlDbType.Double, 0);
            scom.Parameters.Add("COL_Available_Balance_Amount", MySqlDbType.Double, 0);
            scom.Parameters.Add("COL_Petty_Cash_Book_Remark", MySqlDbType.Text, 65535);
            scom.Parameters.Add("COL_Created_Date", MySqlDbType.DateTime, 0);
            scom.Parameters.Add("COL_Created_User", MySqlDbType.Int32, 0);
            scom.Parameters.Add("COL_Edited_Date", MySqlDbType.DateTime, 0);
            scom.Parameters.Add("COL_Edited_User", MySqlDbType.Int32, 0);
            scom.Parameters.Add("COL_Is_Active", MySqlDbType.Bit, 0);

            scom.Parameters["COL_Id_Petty_Cash_Book"].Value         = objCls.Id_Petty_Cash_Book;
            scom.Parameters["COL_Petty_Cash_Book_Name"].Value       = objCls.Petty_Cash_Book_Name;
            scom.Parameters["COL_Petty_Cash_Book_Code"].Value       = objCls.Petty_Cash_Book_Code;
            scom.Parameters["COL_Petty_Cash_Book_Max_Amount"].Value = objCls.Petty_Cash_Book_Max_Amount;
            scom.Parameters["COL_Available_Balance_Amount"].Value   = objCls.Available_Balance_Amount;
            scom.Parameters["COL_Petty_Cash_Book_Remark"].Value     = objCls.Petty_Cash_Book_Remark;
            scom.Parameters["COL_Created_Date"].Value = objCls.Created_Date;
            scom.Parameters["COL_Created_User"].Value = objCls.Created_User;
            scom.Parameters["COL_Edited_Date"].Value  = objCls.Edited_Date;
            scom.Parameters["COL_Edited_User"].Value  = objCls.Edited_User;
            scom.Parameters["COL_Is_Active"].Value    = objCls.Is_Active;


            scon.Open();
            scom.ExecuteNonQuery();
            scon.Close();
        }