Exemplo n.º 1
0
        // GET: Store/Details/5
        public ActionResult Details(int id)
        {
            SystemFail error = new SystemFail();
            Store      store = StoreBLL.GetStoreById(id, error);

            return(View(store));
        }
Exemplo n.º 2
0
        protected void grdstoreReqDelivery_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            try
            {
                StoreBLL unitBll = new StoreBLL();

                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    var row = unitBll.GetStorByOcode(((SessionUser)Session["SessionUser"]).OCode.ToString());
                    //Find the DropDownList in the Row
                    DropDownList ddlStoreList = (e.Row.FindControl("ddlStoreList") as DropDownList);
                    ddlStoreList.DataSource     = row;
                    ddlStoreList.DataTextField  = "StoreName";
                    ddlStoreList.DataValueField = "Store_Code";
                    ddlStoreList.DataBind();
                    ddlStoreList.Items.Insert(0, new ListItem("---Select---", "0"));

                    var          result   = iChallanBll.GetListProgram();
                    DropDownList ddlStyle = (e.Row.FindControl("ddlStyle") as DropDownList);
                    ddlStyle.DataSource     = result;
                    ddlStyle.DataValueField = "ProgramID";
                    ddlStyle.DataTextField  = "ProgramName";
                    ddlStyle.DataBind();
                    ddlStyle.Items.Insert(0, new ListItem("-Select Program-", "0"));
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 3
0
    /// <summary>
    /// 更新用户信息
    /// </summary>
    /// <param name="oAModel"></param>
    /// <returns></returns>
    public string SetAdmin(AdminModel oAModel)
    {
        string ret = Config.Fail;

        try
        {
            ret = ad.SetAdmin(oAModel);
            int  Id   = 0;
            bool flag = Int32.TryParse(ret, out Id);
            if (flag && Id > 0)
            {
                if (oAModel.Dealer != null)
                {
                    DealerBLL db = new DealerBLL();
                    db.SetDealerInfo(oAModel.Dealer);
                }
                if (oAModel.Store != null)
                {
                    StoreBLL sb = new StoreBLL();
                    sb.SetStoreInfo(oAModel.Store);
                }
                return(Config.Success);
            }
        }
        catch (Exception ex)
        {
            WriteLog.WriteExceptionLog("ZB.BLL.Authorization.AdminBLL.SetAdmin()", ex);
            return(Config.ExceptionMsg);
        }
        return(ret);
    }
Exemplo n.º 4
0
        public ActionResult Edit(int id)
        {
            StoreInfo info = StoreBLL.GetList(p => p.ID == id).FirstOrDefault();


            return(View(info));
        }
Exemplo n.º 5
0
    private void LoadStore()
    {
        ListItem emptyitem = new ListItem();

        emptyitem.Text  = "";
        emptyitem.Value = "";
        store_ddl.Items.Add(emptyitem);

        StoreBLL          sb    = new StoreBLL();
        int               count = 0;
        List <StoreModel> list  = new List <StoreModel>();
        AdminModel        user  = Common.GetLoginAdmin(HttpContext.Current);

        if (user.Type == AdminType.Managers)
        {
            sb.GetStoreModelList(1, 10000000, null, null, null, out count, out list);
        }
        else if (user.Type == AdminType.Dealer)
        {
            sb.GetStoreModelList(1, 10000000, null, null, user.AdminId, out count, out list);
            js = " $('#ContentPlaceHolder1_store_ddl').chosen({ allow_single_deselect: true });";
        }
        foreach (StoreModel model in list)
        {
            ListItem item = new ListItem();
            item.Text  = model.StoreName;
            item.Value = model.AdminId.ToString();
            store_ddl.Items.Add(item);
        }
    }
Exemplo n.º 6
0
        /// <summary>
        /// 获取门店列表
        /// </summary>
        public string GetDefaultStoreListData()
        {
            var    service = new StoreBLL(CurrentUserInfo);
            string content = string.Empty;

            string key = string.Empty;

            if (Request("StoreID") != null && Request("StoreID") != string.Empty)
            {
                key = Request("StoreID").ToString().Trim();
            }

            var queryEntity = new StoreEntity();

            queryEntity.StoreID = key;
            int pageIndex = Utils.GetIntVal(FormatParamValue(Request("page"))) - 1;

            var data           = service.GetList(queryEntity, pageIndex, 1000);
            var dataTotalCount = service.GetListCount(queryEntity);

            content = string.Format("{{\"totalCount\":{1},\"topics\":{0}}}",
                                    data.ToJSON(),
                                    dataTotalCount);
            return(content);
        }
Exemplo n.º 7
0
 public AdminBLL()
 {
     rd = new RoleDAL();
     pd = new PermissionsDAL();
     ad = new AdminDAL();
     dd = new DealerBLL();
     sd = new StoreBLL();
 }
Exemplo n.º 8
0
        public void VerifyOrdersInfoType()
        {
            var model    = new StoreBLL();
            var result   = model.GetOrdersInfo();
            var expected = typeof(List <object[]>);

            Assert.IsType <List <object[]> > (result);
            Assert.IsType(expected, result);
        }
Exemplo n.º 9
0
        public ActionResult Index(int page = 1)
        {
            var list = StoreBLL.GetList(p => true);

            list = list.OrderByDescending(p => p.ID);
            var result = list.ToPagedList(page, PageSize);

            return(View(result));
        }
Exemplo n.º 10
0
        public void VerifyCustomersExpensesType()
        {
            var model    = new StoreBLL();
            var result   = model.GetCustomersExpenses();
            var expected = typeof(List <object[]>);

            Assert.IsType <List <object[]> > (result);
            Assert.IsType(expected, result);
        }
Exemplo n.º 11
0
        public void VerifyToysType()
        {
            var model    = new StoreBLL();
            var result   = model.GetToys();
            var expected = typeof(List <Toy>);

            Assert.IsType <List <Toy> > (result);
            Assert.IsType(expected, result);
        }
Exemplo n.º 12
0
        // GET: Article/Create
        public ActionResult Create()
        {
            SystemFail   error  = new SystemFail();
            List <Store> stores = StoreBLL.GetAllStores(error);

            if (stores != null && !error.Error)
            {
                ViewBag.Stores = stores.Select(x => new { Id = x.Id, Name = x.Name });
            }

            return(View());
        }
Exemplo n.º 13
0
        // GET: Store
        public ActionResult Index()
        {
            SystemFail   error  = new SystemFail();
            List <Store> stores = StoreBLL.GetAllStores(error);

            if (stores == null && error.Error)
            {
                ViewBag.StartUpScript = string.Concat("An error has ocurred. Error", error.Message);
            }

            return(View(stores));
        }
Exemplo n.º 14
0
        // GET: Store/Edit/5
        public ActionResult Edit(int id)
        {
            SystemFail error   = new SystemFail();
            Store      article = StoreBLL.GetStoreById(id, error);

            if (article == null && error.Error)
            {
                TempData["StartUp"] = "$.notify('The Store with the specific ID wasn´t found','success')";
                return(RedirectToAction("Index"));
            }
            return(View(article));
        }
Exemplo n.º 15
0
        public ActionResult Delete(int id)
        {
            var info = StoreBLL.GetList(p => p.ID == id).FirstOrDefault();

            if (null == info)
            {
                return(Json(new APIJson(-1, "删除失败,参数有误")));
            }
            if (StoreBLL.Delete(info))
            {
                return(Json(new APIJson(0, "删除成功")));
            }
            return(Json(new APIJson(-1, "删除失败,请重试")));
        }
Exemplo n.º 16
0
        // GET: Store/Delete/5
        public ActionResult Delete(int id)
        {
            SystemFail error = new SystemFail();

            StoreBLL.DeleteStore(id, error);
            if (!error.Error)
            {
                TempData["StartUpScript"] = "$.notify('" + error.Message + "','success');";
            }
            else
            {
                TempData["StartUpScript"] = "$.notify('" + error.Message + "','error');";
            }
            return(RedirectToAction("Index"));
        }
Exemplo n.º 17
0
    public static List <StoreModel> GtetStoreList(out int total)
    {
        List <StoreModel> list = new List <StoreModel>();

        total = 0;
        try
        {
            StoreBLL sb = new StoreBLL();

            sb.GetStoreModelList(1, 1000000, null, null, null, out total, out list);
        }
        catch (Exception ex)
        {
            throw ex;
        }
        return(list);
    }
Exemplo n.º 18
0
        public void syncwelFareStore()
        {
            var interfaceName      = "syncwelFareStore";
            var loggingSessionInfo = BaseService.GetLoggingSession();
            var storeService       = new StoreBLL(loggingSessionInfo);

            var dsStores = new DataSet();
            var stores   = new StoreList();

            stores.storelist = new List <Store>();

            //更新接口同步表
            var queryList = UpdateInterfaceTimestamp(interfaceName, loggingSessionInfo);

            if (queryList != null && queryList.Length > 0)
            {
                //存在,根据日期条件查询
                dsStores = storeService.GetSynWelfareStoreList(queryList.FirstOrDefault().LatestTime.ToString());
            }
            else
            {
                //不存在,查询所有数据
                dsStores = storeService.GetSynWelfareStoreList(string.Empty);
            }

            if (dsStores != null && dsStores.Tables.Count > 0 && dsStores.Tables[0].Rows.Count > 0)
            {
                stores.storelist = DataTableToObject.ConvertToList <Store>(dsStores.Tables[0]);

                //上传数据
                var content = stores.ToJSON();
                var result  = UploadData(interfaceName, stores.ToJSON());

                //写入接口日志
                var logEntity = new ZInterfaceLogEntity()
                {
                    LogId         = Utils.NewGuid(),
                    InterfaceName = interfaceName,
                    Params        = content,
                    ResultCode    = result.code,
                    ResultDesc    = result.description
                };

                InsertInterfaceLog(logEntity, loggingSessionInfo);
            }
        }
Exemplo n.º 19
0
        public ActionResult Edit(StoreInfo info)
        {
            StoreInfo infoExist = StoreBLL.GetList(p => p.Name == info.Name && p.ID != info.ID).FirstOrDefault();

            if (infoExist != null)
            {
                return(Json(new APIJson(-1, "名称已存在")));
            }
            if (string.IsNullOrEmpty(info.Name))
            {
                return(Json(new APIJson(-1, "名称未填写")));
            }
            if (string.IsNullOrEmpty(info.Name.Trim()))
            {
                return(Json(new APIJson(-1, "名称不能是空格,请正确填写")));
            }
            if (null == info.IP)
            {
                info.IP = string.Empty;
            }
            infoExist = StoreBLL.GetList(p => p.ID == info.ID).FirstOrDefault();
            if (null == infoExist)
            {
                return(Json(new APIJson(-1, "parms error")));
            }
            if (!string.IsNullOrEmpty(info.Password))
            {
                bool IsPassWordValidate = ValidatePassWord(info);
                if (!IsPassWordValidate || info.Password.Length < 8 || info.Password.Length > 16)
                {
                    return(Json(new APIJson("密码必需包含数字、字母,并且长度在8到16位")));
                }
                infoExist.Password = Tool.Md5Helper.Md5(info.Password);
            }

            infoExist.Name = info.Name;
            infoExist.Code = info.Code;
            infoExist.IP   = info.IP;
            if (StoreBLL.Edit(infoExist))
            {
                return(Json(new APIJson(0, "提交成功")));
            }
            return(Json(new APIJson(-1, "提交失败")));
        }
Exemplo n.º 20
0
        static public void ShowResult(int k)
        {
            try {
                StoreBLL logicObj = new StoreBLL();
                ShowInfo show     = new ShowInfo();
                switch (k)
                {
                case 1:
                    show.ShowToys(logicObj.GetToys());
                    break;

                case 2:
                    show.ShowOrders(logicObj.GetOrders());
                    break;

                case 3:
                    show.ShowCustomers(logicObj.GetCustomers());
                    break;

                case 4:
                    show.ShowOrdersInfo(logicObj.GetOrdersInfo());
                    break;

                case 5:
                    show.ShowSoldToys(logicObj.GetSoldToys());
                    break;

                case 6:
                    show.ShowCustomersExpenses(logicObj.GetCustomersExpenses());
                    break;

                case 7:
                    Environment.Exit(0);
                    break;

                default:
                    System.Console.WriteLine("Please, press 1-7.");
                    break;
                }
            } catch {
                System.Console.WriteLine("Something wrong");
            }
        }
Exemplo n.º 21
0
        public ActionResult Create(StoreInfo info)
        {
            info.CreateDate = DateTime.Now;
            info.IP         = string.Empty;
            StoreInfo infoExist = StoreBLL.GetList(p => p.Name == info.Name).FirstOrDefault();

            if (null != infoExist)
            {
                return(Json(new APIJson(-1, "名称已存在")));
            }
            if (string.IsNullOrEmpty(info.Name))
            {
                return(Json(new APIJson(-1, "名称未填写")));
            }
            if (string.IsNullOrEmpty(info.Name.Trim()))
            {
                return(Json(new APIJson(-1, "名称不能是空格,请正确填写")));
            }
            if (string.IsNullOrEmpty(info.Code))
            {
                info.Code = info.Name;
            }
            if (!string.IsNullOrEmpty(info.Password))
            {
                bool IsPassWordValidate = ValidatePassWord(info);
                if (!IsPassWordValidate || info.Password.Length < 8 || info.Password.Length > 16)
                {
                    return(Json(new APIJson("密码必需包含数字、字母,并且长度在8到16位")));
                }
            }
            else
            {
                info.Password = "******";
            }
            info.Password = Tool.Md5Helper.Md5(info.Password);
            StoreBLL.Create(info);
            if (info.ID > 0)
            {
                return(Json(new APIJson(0, "添加成功", new { info.ID, info.Name })));
            }
            return(Json(new APIJson(-1, "添加失败")));
        }
Exemplo n.º 22
0
    private void LoadStore(AdminModel user)
    {
        ListItem emptyitem = new ListItem();

        emptyitem.Text  = "";
        emptyitem.Value = "";
        store_ddl.Items.Add(emptyitem);

        StoreBLL          sb    = new StoreBLL();
        int               count = 0;
        List <StoreModel> list  = new List <StoreModel>();

        sb.GetStoreModelList(1, 10000000, null, null, user.AdminId, out count, out list);
        foreach (StoreModel model in list)
        {
            ListItem item = new ListItem();
            item.Text  = model.StoreName;
            item.Value = model.AdminId.ToString();
            store_ddl.Items.Add(item);
        }
    }
Exemplo n.º 23
0
        public ActionResult Edit(Store model)
        {
            SystemFail error = new SystemFail();

            if (ModelState.IsValid)
            {
                StoreBLL.UpdateStore(model, error);
                if (!error.Error)
                {
                    TempData["StartUpScript"] = "$.notify('" + error.Message + "','success');";
                }
                else
                {
                    ViewBag.StartupScript = "$.notify('" + error.Message + "','error');";
                    return(View(model));
                }
            }
            else
            {
                return(View(model));
            }
            return(RedirectToAction("Index"));
        }
Exemplo n.º 24
0
        public ActionResult Create(Store model)
        {
            SystemFail error = new SystemFail();

            if (ModelState.IsValid)
            {
                StoreBLL.CreateStore(model, error);
                if (!error.Error)
                {
                    TempData["StartUpScript"] = "$.notify('" + error.Message + "','success');";
                }
                else
                {
                    TempData["StartUpScript"] = "$.notify('" + error.Message + "','error');";
                }
            }
            else
            {
                ViewBag.StartupScript = "$.notify('Some errores were found in the formulary information. Please check it','warn')";
                return(View(model));
            }

            return(RedirectToAction("Index"));
        }