Пример #1
0
        protected void btnEnter_Click(object sender, EventArgs e)
        {
            model                 = new DealerModel();
            model.Name            = txtName.Text;
            model.Surname         = txtSurname.Text;
            model.Landline        = txtLandline.Text;
            model.CellphoneNumber = txtCellNumber.Text;
            model.Email           = txtEmail.Text;
            model.DealershipName  = ddlDealerships.SelectedItem.Text;//txtDealershipName.Text;
            model.DealerType      = ddlDealerType.Text;
            model.Status          = ddlStatus.Text;
            model.Province        = ddlProvince.Text;
            model.Comment         = txtComment.Text;

            DealerDAL.UpdateDealerDetails(model);
            ShowMessage(ref lblMessage, MessageType.Success, "Dealer Updated Successfully");
            lblMessage.Visible = true;
        }
Пример #2
0
        public ActionResult Index()
        {
            DealerDAL dealerDal = new DealerDAL();

            return(View(dealerDal.GetDealers()));
        }
Пример #3
0
 public static int SaveDealerDetails(DealerModel model)
 {
     return(DealerDAL.SaveDealerDetails(model));
 }
Пример #4
0
    /// <summary>
    /// 得到用户列表
    /// </summary>
    /// <param name="PageIndex"></param>
    /// <param name="PageNum"></param>
    /// <param name="where"></param>
    /// <param name="Count"></param>
    /// <returns></returns>
    public List <AdminModel> GetAdminList(int PageIndex, int PageNum, string where, out int Count)
    {
        List <AdminModel> olist = new List <AdminModel>();

        Count = 0;
        SqlConnection sqlConnection = new SqlConnection(Config.ConnectionString);
        SqlCommand    sqlcommand    = new SqlCommand("sp_AdminList", sqlConnection);

        sqlcommand.CommandType = CommandType.StoredProcedure;

        SqlParameter _PageIndex = new SqlParameter("@PageIndex", PageIndex);

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

        SqlParameter _PageNum = new SqlParameter("@PageNum", PageNum);

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

        SqlParameter _where = new SqlParameter("@where", where);

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

        SqlParameter _Count = new SqlParameter("@Count", SqlDbType.Int);

        _Count.Direction = ParameterDirection.Output;
        sqlcommand.Parameters.Add(_Count);
        try
        {
            sqlConnection.Open();
            using (IDataReader idr = sqlcommand.ExecuteReader())
            {
                DealerDAL      dd   = new DealerDAL();
                StoreDAL       sd   = new StoreDAL();
                PermissionsDAL pDal = new PermissionsDAL();
                while (idr.Read())
                {
                    AdminModel oCModel = new AdminModel();
                    if (idr["AdminId"] != DBNull.Value)
                    {
                        oCModel.AdminId = (int)idr["AdminId"];
                    }
                    if (idr["AdminName"] != DBNull.Value)
                    {
                        oCModel.AdminName = (string)idr["AdminName"];
                    }
                    if (idr["AdminPassword"] != DBNull.Value)
                    {
                        oCModel.AdminPassword = (string)idr["AdminPassword"];
                    }
                    if (idr["Type"] != DBNull.Value)
                    {
                        oCModel.Type = (AdminType)idr["Type"];
                    }
                    if (idr["RoleId"] != DBNull.Value)
                    {
                        oCModel.RoleId = (int)idr["RoleId"];
                    }
                    if (idr["Status"] != DBNull.Value)
                    {
                        oCModel.Status = (bool)idr["Status"];
                    }
                    if (idr["CreateTime"] != DBNull.Value)
                    {
                        oCModel.CreateTime = (DateTime)idr["CreateTime"];
                    }

                    if (idr["CreatorId"] != DBNull.Value)
                    {
                        oCModel.CreatorId = (int)idr["CreatorId"];
                    }
                    int Totoal = 0;
                    List <DealerModel> dModel = dd.GetDealerModelList(1, 1, "DealerInfo.AdminId=" + oCModel.AdminId, out Totoal);
                    if (dModel != null & dModel.Count > 0)
                    {
                        oCModel.Dealer = dModel[0];
                    }
                    List <StoreModel> oSMoel = sd.GetStoreModelList(1, 1, "StoreInfo.AdminId=" + oCModel.AdminId, out Totoal);
                    if (oSMoel != null & oSMoel.Count > 0)
                    {
                        oCModel.Store = oSMoel[0];
                    }
                    RoleModel role = new RoleModel();
                    if (idr["RoleId"] != DBNull.Value)
                    {
                        role.RoleId = (int)idr["RoleId"];
                    }
                    if (idr["RoleId"] != DBNull.Value)
                    {
                        role.RoleName = (string)idr["RoleName"];
                    }
                    if (idr["RoleId"] != DBNull.Value)
                    {
                        role.Permissions = pDal.GetRoleModulePermission(role.RoleId);
                    }
                    oCModel.Role = role;
                    olist.Add(oCModel);
                }
            }
            Count = int.Parse(_Count.Value.ToString());
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            sqlConnection.Close();
        }
        return(olist);
    }
Пример #5
0
 public DealerBLL()
 {
     dd = new DealerDAL();
 }