Beispiel #1
0
    /// <summary>
    /// 更新技师信息
    /// </summary>
    /// <param name="oUModel"></param>
    /// <returns></returns>
    public string SetMechanic(MechanicModel oMModel)
    {
        List <SqlParameter> sqlparameterlist = new List <SqlParameter>();
        SqlParameter        _op = new SqlParameter("@op", "Up");

        _op.Direction = ParameterDirection.Input;
        sqlparameterlist.Add(_op);


        SqlParameter _MechanicId = new SqlParameter("@MechanicId", oMModel.MechanicId);

        _MechanicId.Direction = ParameterDirection.Input;
        sqlparameterlist.Add(_MechanicId);

        SqlParameter _Name = new SqlParameter("@Name", oMModel.Name == null ? (Object)DBNull.Value : oMModel.Name);

        _Name.Direction = ParameterDirection.Input;
        sqlparameterlist.Add(_Name);

        SqlParameter _Introduction = new SqlParameter("@Introduction", oMModel.Introduction == null ? (Object)DBNull.Value : oMModel.Introduction);

        _Introduction.Direction = ParameterDirection.Input;
        sqlparameterlist.Add(_Introduction);

        SqlParameter _Type = new SqlParameter("@Type", oMModel.Type);

        _Type.Direction = ParameterDirection.Input;
        sqlparameterlist.Add(_Type);

        SqlParameter _Mobile = new SqlParameter("@Mobile", oMModel.Mobile == null ? (Object)DBNull.Value : oMModel.Mobile);

        _Mobile.Direction = ParameterDirection.Input;
        sqlparameterlist.Add(_Mobile);

        SqlParameter _Address = new SqlParameter("@Address", oMModel.Address == null ? (Object)DBNull.Value : oMModel.Address);

        _Address.Direction = ParameterDirection.Input;
        sqlparameterlist.Add(_Address);

        SqlParameter _Email = new SqlParameter("@Email", oMModel.Email == null ? (Object)DBNull.Value : oMModel.Email);

        _Email.Direction = ParameterDirection.Input;
        sqlparameterlist.Add(_Email);


        SqlParameter _StoreId = new SqlParameter("@StoreId", (Object)DBNull.Value);

        _StoreId.Direction = ParameterDirection.Input;
        sqlparameterlist.Add(_StoreId);

        SqlParameter _result = new SqlParameter("@result", SqlDbType.VarChar, 10);

        _result.Direction = ParameterDirection.Output;
        sqlparameterlist.Add(_result);

        SqlActuator.ExecuteNonQuery("sp_MechanicInfo", sqlparameterlist, Config.ConnectionString);

        return(_result.Value.ToString());
    }
Beispiel #2
0
        public static MechanicModel FromEntityToModel(Mecanic entityMechanic)
        {
            MechanicModel mechanicModel = new MechanicModel();

            mechanicModel.MechanicId = entityMechanic.MecanicId;
            mechanicModel.FirstName  = entityMechanic.Nume;
            mechanicModel.LastName   = entityMechanic.Prenume;
            return(mechanicModel);
        }
Beispiel #3
0
        public static Mecanic FromModelToEntity(MechanicModel mechanicModel)
        {
            Mecanic mechanicEntity = new Mecanic();

            if (mechanicModel != null)
            {
                mechanicEntity.MecanicId = mechanicModel.MechanicId;
                mechanicEntity.Nume      = mechanicModel.FirstName;
                mechanicEntity.Prenume   = mechanicModel.LastName;
            }

            return(mechanicEntity);
        }
Beispiel #4
0
 /// <summary>
 /// 得到技师列表
 /// </summary>
 /// <param name="StoreId"></param>
 /// <param name="olist"></param>
 /// <returns></returns>
 public string GetMechanic(int MechanicId, out MechanicModel o)
 {
     o = new MechanicModel();
     try
     {
         o = ud.GetMechanic(MechanicId);
         return(Config.Success);
     }
     catch (Exception ex)
     {
         WriteLog.WriteExceptionLog("UserBLL.GetMechanic()", ex);
         return(Config.ExceptionMsg);
     }
 }
Beispiel #5
0
    /// <summary>
    /// 更新技师信息
    /// </summary>
    /// <param name="oUModel"></param>
    /// <returns></returns>
    public string SetMechanic(MechanicModel oMModel)
    {
        string ret = Config.Fail;

        try
        {
            ret = ud.SetMechanic(oMModel);
            int  Id   = 0;
            bool flag = Int32.TryParse(ret, out Id);
            if (flag && Id > 0)
            {
                return(Config.Success);
            }
        }
        catch (Exception ex)
        {
            WriteLog.WriteExceptionLog("UserBLL.SetMechanic()", ex);
            return(Config.ExceptionMsg);
        }
        return(ret);
    }
Beispiel #6
0
    /// <summary>
    /// 得到技师列表
    /// </summary>
    /// <param name="PageIndex"></param>
    /// <param name="PageNum"></param>
    /// <param name="where"></param>
    /// <param name="Count"></param>
    /// <returns></returns>
    public List <MechanicModel> GetMechanicList(int DealerId, int StoreId)
    {
        List <MechanicModel> olist         = new List <MechanicModel>();
        SqlConnection        sqlConnection = new SqlConnection(Config.ConnectionString);
        SqlCommand           sqlcommand    = new SqlCommand("sp_MechanicInfo", sqlConnection);

        sqlcommand.CommandType = CommandType.StoredProcedure;

        SqlParameter _op = new SqlParameter("@op", "select");

        _op.Direction = ParameterDirection.Input;
        sqlcommand.Parameters.Add(_op);


        SqlParameter _MechanicId = new SqlParameter("@MechanicId", (Object)DBNull.Value);

        _MechanicId.Direction = ParameterDirection.Input;
        sqlcommand.Parameters.Add(_MechanicId);

        SqlParameter _Name = new SqlParameter("@Name", (Object)DBNull.Value);

        _Name.Direction = ParameterDirection.Input;
        sqlcommand.Parameters.Add(_Name);

        SqlParameter _Introduction = new SqlParameter("@Introduction", (Object)DBNull.Value);

        _Introduction.Direction = ParameterDirection.Input;
        sqlcommand.Parameters.Add(_Introduction);

        SqlParameter _Type = new SqlParameter("@Type", DealerId);

        _Type.Direction = ParameterDirection.Input;
        sqlcommand.Parameters.Add(_Type);

        SqlParameter _Mobile = new SqlParameter("@Mobile", (Object)DBNull.Value);

        _Mobile.Direction = ParameterDirection.Input;
        sqlcommand.Parameters.Add(_Mobile);

        SqlParameter _Address = new SqlParameter("@Address", (Object)DBNull.Value);

        _Address.Direction = ParameterDirection.Input;
        sqlcommand.Parameters.Add(_Address);

        SqlParameter _Email = new SqlParameter("@Email", (Object)DBNull.Value);

        _Email.Direction = ParameterDirection.Input;
        sqlcommand.Parameters.Add(_Email);


        SqlParameter _StoreId = new SqlParameter("@StoreId", StoreId);

        _StoreId.Direction = ParameterDirection.Input;
        sqlcommand.Parameters.Add(_StoreId);

        SqlParameter _result = new SqlParameter("@result", SqlDbType.VarChar, 10);

        _result.Direction = ParameterDirection.Output;
        sqlcommand.Parameters.Add(_result);

        try
        {
            sqlConnection.Open();
            using (IDataReader idr = sqlcommand.ExecuteReader())
            {
                while (idr.Read())
                {
                    MechanicModel oCModel = new MechanicModel();
                    oCModel.MechanicId = (int)idr["MechanicId"];
                    if (idr["Name"] != DBNull.Value)
                    {
                        oCModel.Name = (string)idr["Name"];
                    }
                    if (idr["Introduction"] != DBNull.Value)
                    {
                        oCModel.Introduction = (string)idr["Introduction"];
                    }
                    if (idr["Type"] != DBNull.Value)
                    {
                        oCModel.Type = (int)idr["Type"];
                    }
                    if (idr["Mobile"] != DBNull.Value)
                    {
                        oCModel.Mobile = (string)idr["Mobile"];
                    }
                    if (idr["Email"] != DBNull.Value)
                    {
                        oCModel.Email = (string)idr["Email"];
                    }
                    if (idr["CreateTime"] != DBNull.Value)
                    {
                        oCModel.CreateTime = (DateTime)idr["CreateTime"];
                    }
                    if (idr["StoreId"] != DBNull.Value)
                    {
                        oCModel.StoreId = (int)idr["StoreId"];
                    }
                    if (idr["StoreName"] != DBNull.Value)
                    {
                        oCModel.StoreName = (string)idr["StoreName"];
                    }
                    if (idr["DealerCompanyName"] != DBNull.Value)
                    {
                        oCModel.DealerName = (string)idr["DealerCompanyName"];
                    }
                    if (idr["Address"] != DBNull.Value)
                    {
                        oCModel.Address = (string)idr["Address"];
                    }
                    olist.Add(oCModel);
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            sqlConnection.Close();
        }
        return(olist);
    }