예제 #1
0
        public string DelProductOnlineBook(string itemAppend)
        {
            try
            {
                if (!HttpContext.Current.User.IsInRole("Administrators"))
                {
                    return(MC.Role_InvalidError);
                }

                itemAppend = itemAppend.Trim();
                if (string.IsNullOrEmpty(itemAppend))
                {
                    return(MC.Submit_InvalidRow);
                }

                string[] items = itemAppend.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                ProductOnlineBook bll = new ProductOnlineBook();
                bll.DeleteBatch(items.ToList <object>());

                return("1");
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
        private void Bind()
        {
            //查询条件
            GetSearchItem();

            int totalRecords      = 0;
            ProductOnlineBook bll = new ProductOnlineBook();

            rpData.DataSource = bll.GetList(pageIndex, pageSize, out totalRecords, sqlWhere == null ? null : sqlWhere.ToString(), parms == null ? null : parms.ToArray());
            rpData.DataBind();

            myDataAppend.Append("<div id=\"myDataForPage\" style=\"display:none;\">[{\"PageIndex\":\"" + pageIndex + "\",\"PageSize\":\"" + pageSize + "\",\"TotalRecord\":\"" + totalRecords + "\",\"QueryStr\":\"" + queryStr.ToString() + "\"}]</div>");
        }
예제 #3
0
        public ResResult SaveProductOnlineBook(string customerName, string clientType, string telPhone, string mobilePhone, string fax, string email, string address, string bookProduct, decimal price)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(customerName))
                {
                    return(ResError("客户名称不能为空字符串"));
                }
                if (string.IsNullOrWhiteSpace(clientType))
                {
                    return(ResError("客户类型不能为空字符串"));
                }
                if (string.IsNullOrWhiteSpace(bookProduct))
                {
                    return(ResError("预约产品不能为空字符串"));
                }
                if (price < 1)
                {
                    return(ResError("预约金额值无效"));
                }
                if (string.IsNullOrWhiteSpace(telPhone) && string.IsNullOrWhiteSpace(mobilePhone) && string.IsNullOrWhiteSpace(email) && string.IsNullOrWhiteSpace(fax))
                {
                    return(ResError("未找到任何联系方式,请至少填写一个联系方式"));
                }

                ProductOnlineBookInfo model = new ProductOnlineBookInfo();
                model.CustomerName    = customerName.Trim();
                model.ClientType      = clientType.Trim();
                model.TelPhone        = telPhone.Trim();
                model.MobilePhone     = mobilePhone.Trim();
                model.Fax             = fax.Trim();
                model.Email           = email.Trim();
                model.Address         = address.Trim();
                model.BookProduct     = bookProduct.Trim();
                model.Price           = price;
                model.LastUpdatedDate = DateTime.Now;

                ProductOnlineBook bll = new ProductOnlineBook();
                int effect            = bll.Insert(model);
                if (effect < 1)
                {
                    return(ResError("连接数据库操作异常,请稍后再重试"));
                }

                return(ResSuccess("操作成功"));
            }
            catch (Exception ex)
            {
                return(ResError(ex.Message));
            }
        }