Esempio n. 1
0
        public bool SaveUpdateChequeEntry(mdlChequeEntry obj_mdlChequeWithoutSummary, string Operation)
        {
            bool IsSaved = false;
            if (con.State == ConnectionState.Open)
            {
                con.Close();
            }
            con.Open();
            SqlTransaction transaction = con.BeginTransaction();
            try
            {
                SqlCommand cmd = new SqlCommand("stp_ERP_ChequeEntryWithoutSummary_CRUD", con, transaction);
                cmd.Parameters.Add("@Pk_TransID", SqlDbType.VarChar, 9).Value = obj_mdlChequeWithoutSummary.TransID;
                cmd.Parameters.Add("@TransDate", SqlDbType.DateTime).Value = obj_mdlChequeWithoutSummary.TransDate;
                cmd.Parameters.Add("@InsNo", SqlDbType.VarChar, 20).Value = obj_mdlChequeWithoutSummary.ChequeNo;
                cmd.Parameters.Add("@DSSID", SqlDbType.VarChar, 6).Value = obj_mdlChequeWithoutSummary.DssID;
                cmd.Parameters.Add("@DueDate", SqlDbType.DateTime).Value = obj_mdlChequeWithoutSummary.DueDate;
                cmd.Parameters.Add("@BankName", SqlDbType.VarChar, 50).Value = obj_mdlChequeWithoutSummary.BankName;
                cmd.Parameters.Add("@ChequeAmount", SqlDbType.Decimal).Value = obj_mdlChequeWithoutSummary.Amount;
                cmd.Parameters.Add("@ReceivedFrom", SqlDbType.VarChar, 100).Value = obj_mdlChequeWithoutSummary.ReceivedFrom;
                cmd.Parameters.Add("@EmployeeID", SqlDbType.VarChar, 6).Value = obj_mdlChequeWithoutSummary.EmployeeID;
                cmd.Parameters.Add("@AccountNo", SqlDbType.VarChar, 50).Value = obj_mdlChequeWithoutSummary.AccountNo;
                cmd.Parameters.Add("@AccountTitle", SqlDbType.VarChar, 50).Value = obj_mdlChequeWithoutSummary.AccountTitle;
                cmd.Parameters.Add("@CompanyID", SqlDbType.VarChar, 3).Value = obj_mdlChequeWithoutSummary.CompanyID;
                cmd.Parameters.Add("@SpoID", SqlDbType.VarChar, 6).Value = obj_mdlChequeWithoutSummary.SpoID;
                cmd.Parameters.Add("@AddUser", SqlDbType.VarChar, 16).Value = obj_mdlChequeWithoutSummary.AddUser;
                // cmd.Parameters.Add("@LockUser", SqlDbType.VarChar, 16).Value = obj_mdlChequeWithoutSummary.LockUser;
                if (Operation == "Save")
                {
                    cmd.Parameters.Add("@Operation", SqlDbType.VarChar, 12).Value = "SaveMaster";
                }
                else if (Operation == "Update")
                {
                    cmd.Parameters.Add("@Operation", SqlDbType.VarChar, 12).Value = "Update";
                }

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.ExecuteNonQuery();

                SaveChequeDetail(obj_mdlChequeWithoutSummary, transaction, cmd);
                transaction.Commit();
                IsSaved = true;
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
            }
            catch (Exception ex)
            {
                transaction.Rollback();
                MessageBox.Show(ex.Message, "ERP - Babar Medicine Company Lahore", MessageBoxButtons.OK, MessageBoxIcon.Error);
                IsSaved = false;
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
            }
            return IsSaved;
        }
Esempio n. 2
0
        private SqlCommand SaveChequeDetail(mdlChequeEntry obj_mdlChequeWithoutSummary, SqlTransaction transaction, SqlCommand cmd)
        {
            //Delete Cheque Entry Detail
            if (obj_mdlChequeWithoutSummary.dsChequeEntry.Tables[0].Rows.Count > 0)
            {
                cmd = new SqlCommand("Delete from D_Cheque_Invoice_Detail where TransId ='" + obj_mdlChequeWithoutSummary.TransID + "'", con, transaction);
                cmd.CommandType = CommandType.Text;
                cmd.ExecuteNonQuery();
            }

            //Inserting Cheque Entry Detail
            for (int i = 0; i <= obj_mdlChequeWithoutSummary.dsChequeEntry.Tables[0].Rows.Count - 1; i++)
            {
                cmd = new SqlCommand("stp_ERP_ChequeEntryWithoutSummary_CRUD", con, transaction);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Clear();
                cmd.Parameters.Add("@Pk_TransID", SqlDbType.VarChar, 9).Value = obj_mdlChequeWithoutSummary.TransID;
                cmd.Parameters.Add("@InvoiceID", SqlDbType.VarChar, 9).Value = obj_mdlChequeWithoutSummary.dsChequeEntry.Tables[0].Rows[i]["Inv. ID"].ToString();
                cmd.Parameters.Add("@ChqInvDate", SqlDbType.DateTime).Value = obj_mdlChequeWithoutSummary.dsChequeEntry.Tables[0].Rows[i]["Inv. Date"].ToString();
                cmd.Parameters.Add("@CustomerID", SqlDbType.VarChar, 6).Value = obj_mdlChequeWithoutSummary.dsChequeEntry.Tables[0].Rows[i]["Cust. ID"].ToString();
                cmd.Parameters.Add("@BalanceAmount", SqlDbType.Decimal).Value = obj_mdlChequeWithoutSummary.dsChequeEntry.Tables[0].Rows[i]["Balance"].ToString();
                cmd.Parameters.Add("@ChqValue", SqlDbType.Decimal).Value = obj_mdlChequeWithoutSummary.dsChequeEntry.Tables[0].Rows[i]["Chq. Value"].ToString();
                cmd.Parameters.Add("@AddTax", SqlDbType.Decimal).Value = obj_mdlChequeWithoutSummary.dsChequeEntry.Tables[0].Rows[i]["Add Tax"].ToString();
                cmd.Parameters.Add("@OldInvID", SqlDbType.VarChar, 6).Value = obj_mdlChequeWithoutSummary.dsChequeEntry.Tables[0].Rows[i]["Old.Inv.ID"].ToString();
                cmd.Parameters.Add("@OldInvDate", SqlDbType.DateTime).Value = obj_mdlChequeWithoutSummary.dsChequeEntry.Tables[0].Rows[i]["Old.Inv.Date"].ToString();
                cmd.Parameters.Add("@Operation", SqlDbType.VarChar, 12).Value = "SaveDetail";
                cmd.ExecuteNonQuery();
            }
            return cmd;
        }
Esempio n. 3
0
 public bool SaveUpdateChequeEntry(mdlChequeEntry obj_mdlChequeWithoutSummary, string Operation)
 {
     return obj_dalChequeWithoutSummary.SaveUpdateChequeEntry(obj_mdlChequeWithoutSummary, Operation);
 }