/// <summary> /// Saves a record to the core_petty_cash_category table. /// </summary> public void Insert(core_petty_cash_category_Objects objCls) { MySqlConnection scon = Connectivity.Cls_Connection.getConnection(); MySqlCommand scom = new MySqlCommand("core_petty_cash_categoryInsert", scon); scom.CommandType = CommandType.StoredProcedure; scom.Parameters.Add("COL_Id_Petty_Cash_Category", MySqlDbType.Int32,0); scom.Parameters.Add("COL_Id_Ledger_Account", MySqlDbType.Int32,0); scom.Parameters.Add("COL_Petty_Cash_Category_Name", MySqlDbType.VarChar,45); scom.Parameters.Add("COL_Petty_Cash_Category_Code", MySqlDbType.VarChar,45); 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_Category"].Value = objCls.Id_Petty_Cash_Category; scom.Parameters["COL_Id_Ledger_Account"].Value = objCls.Id_Ledger_Account; scom.Parameters["COL_Petty_Cash_Category_Name"].Value = objCls.Petty_Cash_Category_Name; scom.Parameters["COL_Petty_Cash_Category_Code"].Value = objCls.Petty_Cash_Category_Code; 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(); }
/// <summary> /// Saves a record to the core_petty_cash_category table. /// </summary> public void Insert(core_petty_cash_category_Objects objCls) { MySqlConnection scon = Connectivity.Cls_Connection.getConnection(); MySqlCommand scom = new MySqlCommand("core_petty_cash_categoryInsert", scon); scom.CommandType = CommandType.StoredProcedure; scom.Parameters.Add("COL_Id_Petty_Cash_Category", MySqlDbType.Int32, 0); scom.Parameters.Add("COL_Id_Ledger_Account", MySqlDbType.Int32, 0); scom.Parameters.Add("COL_Petty_Cash_Category_Name", MySqlDbType.VarChar, 45); scom.Parameters.Add("COL_Petty_Cash_Category_Code", MySqlDbType.VarChar, 45); 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_Category"].Value = objCls.Id_Petty_Cash_Category; scom.Parameters["COL_Id_Ledger_Account"].Value = objCls.Id_Ledger_Account; scom.Parameters["COL_Petty_Cash_Category_Name"].Value = objCls.Petty_Cash_Category_Name; scom.Parameters["COL_Petty_Cash_Category_Code"].Value = objCls.Petty_Cash_Category_Code; 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(); }
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(); }