Beispiel #1
0
        public int ExecuteProcedure(string spName, SqlParameter[] param)
        {
            int count = 0;

            objCmd             = new SqlCommand(spName, OpenConnection());
            objCmd.CommandType = CommandType.StoredProcedure;
            foreach (SqlParameter para in param)
            {
                objCmd.Parameters.Add(para);
            }
            try
            {
                count = objCmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                CLS_ErrorLog objLog = new CLS_ErrorLog();
                objLog.Write(ex);
            }
            finally
            {
                CloseConnection();
                objCmd.Dispose();
            }
            return(count);
        }
Beispiel #2
0
        public SqlDataReader ExecuteReader(string sqlQuery)
        {
            SqlCommand objCmd  = new SqlCommand();
            string     strData = string.Empty;

            try
            {
                objCmd = new SqlCommand(sqlQuery, OpenConnection());
                objCmd.CommandTimeout = 0;
            }
            catch (Exception ex)
            {
                CLS_ErrorLog objLog = new CLS_ErrorLog();
                objLog.Write(ex);
            }
            return(objCmd.ExecuteReader(CommandBehavior.CloseConnection));
        }
Beispiel #3
0
 public DataSet GetData_DS(string sqlQuery)
 {
     objDS = new DataSet();
     objDA = new SqlDataAdapter(sqlQuery, OpenConnection());
     try
     {
         objDA.Fill(objDS);
     }
     catch (Exception ex)
     {
         CLS_ErrorLog objLog = new CLS_ErrorLog();
         objLog.Write(ex);
     }
     finally
     {
         CloseConnection();
         objDA.Dispose();
     }
     return(objDS);
 }
Beispiel #4
0
        public int ExecuteNonQuery(string sqlQuery)
        {
            int count = 0;

            objCmd = new SqlCommand(sqlQuery, OpenConnection());
            try
            {
                count = Convert.ToInt16(objCmd.ExecuteNonQuery());
            }
            catch (Exception ex)
            {
                CLS_ErrorLog objLog = new CLS_ErrorLog();
                objLog.Write(ex);
            }
            finally
            {
                CloseConnection();
                objCmd.Dispose();
            }
            return(count);
        }
Beispiel #5
0
        public string ExecuteScalar(string sqlQuery)
        {
            string     strData = string.Empty;
            SqlCommand objCmd  = new SqlCommand();

            try
            {
                objCmd = new SqlCommand(sqlQuery, OpenConnection());
                objCmd.CommandTimeout = 0;
                strData = Convert.ToString(objCmd.ExecuteScalar());
            }
            catch (Exception ex)
            {
                CLS_ErrorLog objLog = new CLS_ErrorLog();
                objLog.Write(ex);
            }
            finally
            {
                objCmd.Dispose();
                CloseConnection();
            }
            return(strData);
        }
Beispiel #6
0
    //public int InsertUserMaster(PLTaxi ObjPL)
    //{

    //    try
    //    {
    //        SqlParameter[] _Param ={
    //                              new SqlParameter("@UserName",ObjPL.strUserName),
    //                              new SqlParameter("@Password",ObjPL.strPassword),
    //                              new SqlParameter("@MobileNo",ObjPL.MobileNO),
    //                              new SqlParameter("@Role",ObjPL.Role),
    //                              new SqlParameter("@Created_Id",ObjPL.Enteredby),
    //                              new SqlParameter("@Created_Date",ObjPL.CreatedDate),
    //                              new SqlParameter("@Admin","Y"),
    //                              new SqlParameter("@Status","V"),

    //                            };

    //        _INS = objSQL.ExecuteProcedure("Usp_UserMaster_Insert", _Param);
    //    }
    //    catch (Exception Ex)
    //    {
    //        BLErrorLog.Write(Ex);
    //    }


    //    return _INS;

    //}
    public int InsertEndUserMaster(PLTaxi ObjPL)
    {
        try
        {
            SqlParameter[] _Param =
            {
                new SqlParameter("@UserName", ObjPL.strUserName),
                new SqlParameter("@Password", ObjPL.strPassword),
                new SqlParameter("@MobileNo", ObjPL.MobileNO),
                new SqlParameter("@EmailId",  ObjPL.EmailId),
                new SqlParameter("@CreateDt", ObjPL.CreatedDate),
                new SqlParameter("@Status",   "Y"),
            };

            _INS = objSQL.ExecuteProcedure("Usp_ENDUSERMASTER_Insert", _Param);
        }
        catch (Exception Ex)
        {
            BLErrorLog.Write(Ex);
        }


        return(_INS);
    }