public ReqMaster getReqMID(SqlConnection con, int ReqMID)
        {
            DataTable dt          = new DataTable();
            ReqMaster obReqMaster = new ReqMaster();

            try
            {
                SqlDataAdapter da = new SqlDataAdapter("Select * from T_Requisition_Master Where ReqMID = " + @ReqMID.ToString(), con);
                da.SelectCommand.Parameters.Add("@ReqMID", SqlDbType.Int).Value = ReqMID;
                da.Fill(dt);
                da.Dispose();
                if (dt.Rows.Count == 0)
                {
                    return(null);
                }
                obReqMaster.ReqMID       = Convert.ToInt32(dt.Rows[0].Field <object>("ReqMID"));
                obReqMaster.ReqNo        = dt.Rows[0].Field <object>("ReqNo").ToString();
                obReqMaster.ReqSectionID = Convert.ToInt32(dt.Rows[0].Field <object>("ReqSectionID"));
                obReqMaster.ReqDate      = Convert.ToDateTime(dt.Rows[0].Field <object>("ReqDate"));
                obReqMaster.ReqBy        = dt.Rows[0].Field <object>("ReqBy").ToString();
                obReqMaster.Remarks      = dt.Rows[0].Field <object>("Remarks").ToString();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(obReqMaster);
        }
        public int SaveUpdateReqMaster(ReqMaster obReqMaster, SqlConnection con, SqlTransaction trans)
        {
            int        ID  = 0;
            SqlCommand com = null;

            try
            {
                com             = new SqlCommand("spSaveUpdateReqMaster", con, trans);
                com.CommandType = CommandType.StoredProcedure;
                com.Parameters.Add("@ReqMID", SqlDbType.Int).Value           = obReqMaster.ReqMID;
                com.Parameters.Add("@ReqNo", SqlDbType.VarChar, 100).Value   = obReqMaster.ReqNo;
                com.Parameters.Add("@ReqDate", SqlDbType.DateTime).Value     = obReqMaster.ReqDate;
                com.Parameters.Add("@ReqSectionID", SqlDbType.Int).Value     = obReqMaster.ReqSectionID;
                com.Parameters.Add("@ReqBy", SqlDbType.VarChar, 500).Value   = obReqMaster.ReqBy;
                com.Parameters.Add("@Remarks", SqlDbType.VarChar, 500).Value = obReqMaster.Remarks;
                com.Parameters.Add("@CompanyID", SqlDbType.Int).Value        = LogInInfo.CompanyID;
                com.Parameters.Add("@UserID", SqlDbType.Int).Value           = LogInInfo.UserID;
                com.ExecuteNonQuery();

                if (obReqMaster.ReqMID == 0)
                {
                    SqlCommand cmd = new SqlCommand("SELECT ISNULL(MAX(ReqMID),0) FROM T_Requisition_Master", con, trans);
                    ID = Convert.ToInt32(cmd.ExecuteScalar());
                }
                else
                {
                    ID = obReqMaster.ReqMID;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(ID);
        }