Beispiel #1
0
        private void GetInfoneProjectReportPrepareList(HttpContext context, int pageIndex, int pageSize, string keyword, string typeName, Guid parentId)
        {
            var bll = new InfoneProjectReportPrepare();

            if (typeName == "GetProjectsByCustomerId" && parentId != Guid.Empty)
            {
                var prpList = bll.GetProjectsByCustomerId(parentId);
                context.Response.Write(ResResult.ResJsonString(true, "", "{\"total\":" + prpList.Count + ",\"rows\":" + JsonConvert.SerializeObject(prpList) + "}"));
                return;
            }

            int           totalRecord = 0;
            StringBuilder sqlWhere    = null;
            ParamsHelper  parms       = null;

            if (!string.IsNullOrWhiteSpace(keyword))
            {
                parms    = new ParamsHelper();
                sqlWhere = new StringBuilder("and (prp.ProjectName like @Keyword or prp.SpecsModel like @Keyword or prp.ContactMan like @Keyword or prp.ContactPhone like @Keyword) ");
                var parm = new SqlParameter("@Keyword", SqlDbType.NVarChar, 50);
                parm.Value = "%" + keyword + "%";
                parms.Add(parm);
            }
            var list = bll.GetListByJoin(pageIndex, pageSize, out totalRecord, sqlWhere == null ? "" : sqlWhere.ToString(), parms == null ? null : parms.ToArray());

            context.Response.Write(ResResult.ResJsonString(true, "", "{\"total\":" + totalRecord + ",\"rows\":" + JsonConvert.SerializeObject(list) + "}"));
        }
        private void ResResult(bool isOk, string msg, object data)
        {
            ResResult rr = new ResResult();

            context.Response.ContentType = "text/plain";
            context.Response.Write(rr.ResJsonString(isOk, msg, data));
        }
Beispiel #3
0
        private void GetLogisticsDistributionList(HttpContext context, int pageIndex, int pageSize, string keyword)
        {
            var           bll         = new LogisticsDistribution();
            int           totalRecord = 0;
            StringBuilder sqlWhere    = null;
            ParamsHelper  parms       = null;
            var           isSelfView  = false;

            if (HttpContext.Current.User.IsInRole("SelfView"))
            {
                isSelfView = true;
                if (sqlWhere == null)
                {
                    sqlWhere = new StringBuilder(1000);
                }
                sqlWhere.AppendFormat("and lgd.CompanyId in (select FeatureId from FeatureUser fu where fu.UserId = '{0}' and TypeName = 'Company') ", WebCommon.GetUserId());
            }
            if (!string.IsNullOrWhiteSpace(keyword))
            {
                if (sqlWhere == null)
                {
                    sqlWhere = new StringBuilder(1000);
                }
                parms = new ParamsHelper();
                sqlWhere.Append("and (lgd.OrderCode like @Keyword) ");
                var parm = new SqlParameter("@Keyword", SqlDbType.NVarChar, 50);
                parm.Value = "%" + keyword + "%";
                parms.Add(parm);
            }

            var list = bll.GetListByJoin(pageIndex, pageSize, out totalRecord, sqlWhere == null ? null : sqlWhere.ToString(), parms == null ? null : parms.ToArray());

            context.Response.Write(ResResult.ResJsonString(true, "", "{\"total\":" + totalRecord + ",\"rows\":" + JsonConvert.SerializeObject(list) + ",\"IsSelfView\":\"" + isSelfView + "\"}"));
        }
Beispiel #4
0
        private void OnUploadByAssetInStore(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            try
            {
                HttpFileCollection files = context.Request.Files;
                if (files.Count == 0)
                {
                    context.Response.Write("{\"success\": false,\"message\": \"未找到任何可上传的文件,请检查!\"}");
                    return;
                }
                foreach (string item in files.AllKeys)
                {
                    HttpPostedFile file = files[item];
                    if (file == null || file.ContentLength == 0)
                    {
                        continue;
                    }
                    ImportByAssetInStore(context, file);
                }
            }
            catch (Exception ex)
            {
                context.Response.Write(ResResult.ResJsonString(false, ex.Message, ""));
            }
        }
Beispiel #5
0
        public void GetShelfMissionProductInfo(HttpContext context, Guid Id)
        {
            var orderId   = Guid.Parse(context.Request.Form["OrderId"]);
            var productId = Guid.Parse(context.Request.Form["ProductId"]);
            var bll       = new ShelfMissionProduct();

            context.Response.Write(ResResult.ResJsonString(true, "", JsonConvert.SerializeObject(bll.GetModel(Id, orderId, productId))));
        }
Beispiel #6
0
        private void GetStockLocationList(HttpContext context, int pageIndex, int pageSize, string keyword)
        {
            var bll = new StockLocation();
            IList <StockLocationInfo> list;
            int           totalRecord = 0;
            StringBuilder sqlWhere    = null;
            ParamsHelper  parms       = null;

            var zoneId = Guid.Empty;

            if (!string.IsNullOrWhiteSpace(context.Request.Form["ZoneId"]))
            {
                Guid.TryParse(context.Request.Form["ZoneId"], out zoneId);
            }
            if (!zoneId.Equals(Guid.Empty))
            {
                if (sqlWhere == null)
                {
                    sqlWhere = new StringBuilder(300);
                }
                if (parms == null)
                {
                    parms = new ParamsHelper();
                }
                sqlWhere.Append("and (ZoneId = @ZoneId) ");
                var parm = new SqlParameter("@ZoneId", SqlDbType.UniqueIdentifier);
                parm.Value = parm.Value = zoneId;
                parms.Add(parm);
            }

            if (!string.IsNullOrWhiteSpace(keyword))
            {
                if (sqlWhere == null)
                {
                    sqlWhere = new StringBuilder(200);
                }
                if (parms == null)
                {
                    parms = new ParamsHelper();
                }

                sqlWhere.Append("and (sl.Code like @Keyword or sl.Named like @Keyword) ");
                var parm = new SqlParameter("@Keyword", SqlDbType.NVarChar, 50);
                parm.Value = parm.Value = "%" + keyword + "%";
                parms.Add(parm);
            }

            if (!zoneId.Equals(Guid.Empty))
            {
                list = bll.GetList(sqlWhere == null ? null : sqlWhere.ToString(), parms == null ? null : parms.ToArray());
            }
            else
            {
                list = bll.GetListByJoin(pageIndex, pageSize, out totalRecord, sqlWhere == null ? null : sqlWhere.ToString(), parms == null ? null : parms.ToArray());
            }

            context.Response.Write(ResResult.ResJsonString(true, "", "{\"total\":" + totalRecord + ",\"rows\":" + JsonConvert.SerializeObject(list) + "}"));
        }
        private bool getOnePage(string url, int pageIndex, out ArrayList resList)
        {
            resList = new ArrayList();
            bool res = true;

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

            request.Method = "GET";

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            System.IO.StreamReader myreader = new System.IO.StreamReader(response.GetResponseStream(), Encoding.UTF8);

            string responseTxt = myreader.ReadToEnd();

            myreader.Close();

            // 解析Json
            ResResult resResult = new ResResult();

            resResult = JsonConvert.DeserializeObject <ResResult>(responseTxt);

            if (resResult.data.replies != null)
            {
                int offset = 1;
                foreach (ResReply item in resResult.data.replies)
                {
                    ResReplyMember member = item.member;

                    if (this.mids.ContainsKey(member.mid))
                    {
                        offset++;
                        continue;
                    }

                    this.mids.Add(member.mid, true);
                    ArrayList tempList = new ArrayList();
                    tempList.Add(member.mid);
                    tempList.Add(member.uname);
                    tempList.Add(pageIndex);
                    tempList.Add(offset);
                    offset++;

                    resList.Add(tempList);
                }
                this.outputStr += "获取到第" + pageIndex.ToString() + "页评论" + Environment.NewLine;
                this.context.Post(updateTxtFunc, this.outputStr);
            }
            else
            {
                res = false;
            }

            return(res);
        }
Beispiel #8
0
        private void ImportDeviceRepairRecord(HttpContext context, HttpPostedFile file)
        {
            var dt  = OpenXmlHelper.Import(file.InputStream);
            var drc = dt.Rows;

            if (drc.Count == 0)
            {
                context.Response.Write(ResResult.ResJsonString(false, MC.Import_NotDataError, ""));
                return;
            }

            var      currTime = DateTime.Now;
            DateTime time     = DateTime.MinValue;
            var      list     = new List <InfoneDeviceRepairRecordInfo>();
            var      userId   = WebCommon.GetUserId();

            foreach (DataRow dr in drc)
            {
                if (dr["日期"] != null)
                {
                    DateTime.TryParse(dr["日期"].ToString(), out time);
                }
                if (time == DateTime.MinValue)
                {
                    throw new ArgumentException(MC.Import_InvalidError);
                }
                var backDate = DateTime.MinValue;
                DateTime.TryParse(dr["归还日期"].ToString(), out backDate);
                if (backDate == DateTime.MinValue)
                {
                    backDate = DateTime.Parse("1754-01-01");
                }

                var modelInfo = new InfoneDeviceRepairRecordInfo(Guid.Empty, userId, time, dr["客户"].ToString(), dr["序列号"].ToString(), dr["型号"].ToString(), dr["故障原因"].ToString(), dr["解决方案"].ToString(), dr["客户问题"].ToString(), dr["配件"].ToString(), dr["处理情况"].ToString(), dr["是否修好"].ToString(), dr["交接人"].ToString(), dr["是否归还"].ToString() == "是" ? true : false, backDate, dr["登记人"].ToString(), dr["备注"].ToString(), currTime);
                list.Add(modelInfo);
            }

            var bll   = new InfoneDeviceRepairRecord();
            var index = 0;

            foreach (var model in list)
            {
                model.UserId = userId;
                if (bll.Insert(model) < 1)
                {
                    throw new ArgumentException(string.Format("{0}", index > 0 ? "部分数据已经成功导入,但是执行到第“" + index + "”行时发生异常" : "数据导入失败,行“" + index + "”发生异常"));
                }
                index++;
            }
            context.Response.Write(ResResult.ResJsonString(true, "导入成功", ""));
        }
Beispiel #9
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json; charset=utf-8";
            try
            {
                string reqName = "";
                switch (context.Request.HttpMethod.ToUpper())
                {
                case "GET":
                    reqName = context.Request.QueryString["ReqName"];
                    break;

                case "POST":
                    reqName = context.Request.Form["ReqName"];
                    break;

                default:
                    break;
                }
                if (string.IsNullOrWhiteSpace(reqName))
                {
                    return;
                }
                reqName = reqName.Trim();

                switch (reqName)
                {
                case "SaveMenuAccess":
                    SaveMenuAccess(context);
                    break;

                case "ExportOrderMake":
                    ExportOrderMake(context);
                    break;

                case "ExportCustomer":
                    ExportCustomer(context);
                    break;

                default:
                    throw new ArgumentException(MC.Request_Params_InvalidError);
                }
            }
            catch (Exception ex)
            {
                context.Response.Write(ResResult.ResJsonString(false, ex.Message, ""));
            }
        }
Beispiel #10
0
        private void GetTotalOrderSendProduct(HttpContext context)
        {
            var orderIds = context.Request.Form["OrderIds"];

            if (string.IsNullOrWhiteSpace(orderIds))
            {
                throw new ArgumentException(MC.Request_Params_InvalidError);
            }

            var bll   = new OrderSendProduct();
            var datas = bll.GetTotalByOrders(orderIds);

            var s = string.Format(@"{{""TotalPackage"":{0},""TotalVolume"":{1},""TotalWeight"":{2}}}", datas[0], datas[1], datas[2]);

            context.Response.Write(ResResult.ResJsonString(true, "", s));
        }
Beispiel #11
0
        private void GetFeatureUserInfo(HttpContext context)
        {
            var userId   = Guid.Parse(Membership.GetUser(context.Request.Form["UserName"]).ProviderUserKey.ToString());
            var typeName = context.Request.Form["TypeName"];

            var             bll    = new FeatureUser();
            FeatureUserInfo fuInfo = bll.GetModel(userId, typeName);

            if (fuInfo != null)
            {
                context.Response.Write(ResResult.ResJsonString(true, "", JsonConvert.SerializeObject(fuInfo)));
            }
            else
            {
                context.Response.Write(ResResult.ResJsonString(true, "", "{}"));
            }
        }
Beispiel #12
0
        /// <summary>
        /// 微信网页授权,OAuth2授权
        /// </summary>
        /// <param name="code"></param>
        private void GetUserInfoByOAuth(string code)
        {
            if (string.IsNullOrEmpty(code))
            {
                context.Response.Write(ResResult.ResJsonString(true, null, string.Format(_OAuth2Url, _AppID, _WebIndexUrl)));
                return;
            }
            var accessTokenResult = HttpHelper.DoGet(string.Format(_AccessTokenByCodeApi, _AppID, _AppSecret, code.Trim()));

            new CustomException("HandlerWeixin--GetUserInfoByOAuth--accessTokenResult--" + accessTokenResult);
            JObject jAccessTokenInfo = JObject.Parse(accessTokenResult);
            var     sAccessToken     = jAccessTokenInfo["access_token"].ToString();
            var     sRefreshToken    = jAccessTokenInfo["refresh_token"].ToString();
            var     sOpenId          = jAccessTokenInfo["openid"].ToString();
            var     sScope           = jAccessTokenInfo["scope"].ToString();

            var refreshTokenResult = HttpHelper.DoGet(string.Format(_RefreshTokenApi, _AppID, sRefreshToken));

            new CustomException("HandlerWeixin--GetUserInfoByOAuth--refreshTokenResult--" + refreshTokenResult);
            JObject jRefreshTokenInfo = JObject.Parse(refreshTokenResult);

            sAccessToken  = jRefreshTokenInfo["access_token"].ToString();
            sRefreshToken = jRefreshTokenInfo["refresh_token"].ToString();
            sOpenId       = jRefreshTokenInfo["openid"].ToString();
            sScope        = jRefreshTokenInfo["scope"].ToString();

            WeixinUserInfo userInfo = null;

            if (sScope.Contains("snsapi_userinfo"))
            {
                var userInfoResult = HttpHelper.DoGet(string.Format(_SnsapiUserinfoApi, sAccessToken, sOpenId));
                new CustomException("HandlerWeixin--GetUserInfoByOAuth--userInfoResult--" + userInfoResult);
                JObject jUserInfo  = JObject.Parse(userInfoResult);
                var     openid     = jUserInfo["openid"].ToString();
                var     nickname   = jUserInfo["nickname"].ToString();
                var     sex        = jUserInfo["sex"].ToString();
                var     province   = jUserInfo["province"].ToString();
                var     city       = jUserInfo["city"].ToString();
                var     country    = jUserInfo["country"].ToString();
                var     headimgurl = jUserInfo["headimgurl"].ToString();
                var     unionid    = jUserInfo["unionid"] != null ? jUserInfo["unionid"].ToString() : "";
                userInfo = new WeixinUserInfo(openid, nickname, sex, province, city, country, headimgurl, unionid);
            }

            context.Response.Write(ResResult.ResJsonString(true, null, userInfo));
        }
Beispiel #13
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json; charset=utf-8";
            try
            {
                string reqName = "";
                switch (context.Request.HttpMethod.ToUpper())
                {
                case "GET":
                    reqName = context.Request.QueryString["ReqName"];
                    break;

                case "POST":
                    reqName = context.Request.Form["ReqName"];
                    break;

                default:
                    break;
                }
                if (string.IsNullOrWhiteSpace(reqName))
                {
                    return;
                }
                reqName = reqName.Trim();

                switch (reqName)
                {
                case "GetOrderMapList":
                    GetOrderMapList(context);
                    break;

                case "GetLocation":
                    GetLocation(context);
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                context.Response.Write(ResResult.ResJsonString(false, ex.Message, ""));
            }
        }
Beispiel #14
0
        private void GetVehicleList(HttpContext context, int pageIndex, int pageSize, string keyword)
        {
            var           bll         = new Vehicle();
            int           totalRecord = 0;
            StringBuilder sqlWhere    = null;
            ParamsHelper  parms       = null;

            if (!string.IsNullOrWhiteSpace(keyword))
            {
                parms    = new ParamsHelper();
                sqlWhere = new StringBuilder("and (v.VehicleID like @Keyword) ");
                var parm = new SqlParameter("@Keyword", SqlDbType.NVarChar, 50);
                parm.Value = parm.Value = "%" + keyword + "%";
                parms.Add(parm);
            }
            var list = bll.GetListByJoin(pageIndex, pageSize, out totalRecord, sqlWhere == null ? null : sqlWhere.ToString(), parms == null ? null : parms.ToArray());

            context.Response.Write(ResResult.ResJsonString(true, "", "{\"total\":" + totalRecord + ",\"rows\":" + JsonConvert.SerializeObject(list) + "}"));
        }
Beispiel #15
0
        private void GetMesCategoryInfo(HttpContext context)
        {
            var Id = Guid.Empty;

            Guid.TryParse(context.Request.Form["Id"], out Id);
            if (Id.Equals(Guid.Empty))
            {
                context.Response.Write(ResResult.ResJsonString(false, MC.Request_Params_InvalidError, ""));
                return;
            }
            var bll     = new MesCategory();
            var oldInfo = bll.GetModel(Id);

            if (oldInfo == null)
            {
                context.Response.Write(ResResult.ResJsonString(false, MC.Data_NotExist, ""));
                return;
            }

            context.Response.Write(ResResult.ResJsonString(true, "", JsonConvert.SerializeObject(oldInfo)));
        }
Beispiel #16
0
        public JsonResult Save(int TypeOfRoomId, int[] ServiceId)
        {
            var result = new ResResult();

            for (int i = 0; i < ServiceId.Length; i++)
            {
                SaveTypeOfRoomServiceReq saveTypeOfRoomServiceReq = new SaveTypeOfRoomServiceReq()
                {
                    ServiceId    = ServiceId[i],
                    TypeOfRoomId = TypeOfRoomId,
                    Id           = 0
                };
                result = ApiHelper <ResResult> .HttpPostAsync($"typeOfRoomService/save", "POST", saveTypeOfRoomServiceReq);

                if (result.Id < 0)
                {
                    return(Json(new { data = result }));
                }
            }

            return(Json(new { data = result }));
        }
Beispiel #17
0
        /// <summary>
        /// 继承初始化方法
        /// 分析请求的控制器,方法名
        /// </summary>
        /// <param name="requestContext"></param>
        protected override void Initialize(RequestContext requestContext)
        {
            var routDic = requestContext.RouteData.Values;

            controlName = routDic["controller"].ToString();
            actionName  = routDic["action"].ToString();

            //如果session丢失,则直接打开登录页
            var userAccount = WebHelper.GetSession("useraccount");

            if (!controlName.Equals("Login") && (userAccount == null || string.IsNullOrWhiteSpace(userAccount)))
            {
                requestContext.RouteData.Values["controller"] = "Login";
                requestContext.RouteData.Values["action"]     = "Index";
            }
            base.Initialize(requestContext);

            result = new ResResult <object>()
            {
                code = 0, msg = "操作成功", data = string.Empty
            };
        }
Beispiel #18
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json; charset=utf-8";
            try
            {
                string reqName = string.Empty;
                switch (context.Request.HttpMethod.ToUpper())
                {
                case "GET":
                    reqName = context.Request.QueryString["ReqName"];
                    break;

                case "POST":
                    reqName = context.Request.Form["ReqName"];
                    break;

                default:
                    break;
                }
                if (string.IsNullOrEmpty(reqName))
                {
                    throw new ArgumentException(MC.Request_Params_InvalidError);
                }

                switch (reqName)
                {
                case "UploadContentFile":
                    UploadContentFile(context);
                    break;

                default:
                    throw new ArgumentException(MC.Request_Params_InvalidError);
                }
            }
            catch (Exception ex)
            {
                context.Response.Write(ResResult.ResJsonString(false, ex.Message, ""));
            }
        }
Beispiel #19
0
        private void GetMapStaticImage(HttpContext context)
        {
            var width = 0;

            if (!string.IsNullOrWhiteSpace(context.Request.Form["Width"]))
            {
                int.TryParse(context.Request.Form["Width"], out width);
            }
            var height = 0;

            if (!string.IsNullOrWhiteSpace(context.Request.Form["Height"]))
            {
                int.TryParse(context.Request.Form["Height"], out height);
            }
            var center = string.Empty;

            if (!string.IsNullOrWhiteSpace(context.Request.Form["Center"]))
            {
                center = context.Request.Form["Center"].Trim();
            }
            var markers = string.Empty;

            if (!string.IsNullOrWhiteSpace(context.Request.Form["Markers"]))
            {
                markers = context.Request.Form["Markers"].Trim();
            }
            var markerStyles = string.Empty;

            if (!string.IsNullOrWhiteSpace(context.Request.Form["MarkerStyles"]))
            {
                markerStyles = context.Request.Form["MarkerStyles"].Trim();
            }

            MapHelper mh       = new MapHelper();
            var       imageUrl = mh.GetStaticImage(width, height, center, markers, markerStyles);

            context.Response.Write(ResResult.ResJsonString(true, "", imageUrl));
        }
Beispiel #20
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                string reqName = "";
                switch (context.Request.HttpMethod.ToUpper())
                {
                case "GET":
                    reqName = context.Request.QueryString["ReqName"];
                    break;

                case "POST":
                    reqName = context.Request.Form["ReqName"];
                    break;

                default:
                    break;
                }
                if (string.IsNullOrWhiteSpace(reqName))
                {
                    return;
                }

                switch (reqName.Trim())
                {
                case "HtmlToPdf":
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                context.Response.Write(ResResult.ResJsonString(false, ex.Message, ""));
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                dataGridView1.DataSource = null;//clear datagridview1

                label1.Text = "";

                if (_fileName != "" || _timeStamp != "")
                {
                    _fileName  = "";
                    _timeStamp = "";
                }

                string text = DateTime.Now.ToString();

                _timeStamp = text.Replace("/", "_").Replace(":", "_");
                _fileName  = "ReservationsDetailsOn_";

                ResRequest oRequest  = new ResRequest();
                ResResult  oResponse = new ResResult();

                // Build the request to get some reservations
                // All of the filters will be applied together
                {
                    var withBlock = oRequest;
                    withBlock.ResIdFrom         = 0;
                    withBlock.ResIdTo           = 10000;
                    withBlock.ListOfPropertyIds = new int[] { 1, 2, 3, 4 };


                    // Specify some optional data to be populated
                    withBlock.ResOptionalFieldList = new OptionalFieldsRes();
                    {
                        var withBlock1 = withBlock.ResOptionalFieldList;
                        withBlock1.Company        = true;
                        withBlock1.AccountBalance = true;
                    }
                }

                // Get the data from the server
                oResponse = _PublicServiceClient.GetListOfReservations(_Token, oRequest);

                dataGridView1.DataSource = oResponse.ListOfRes;
                var FetchedData = oResponse.ListOfRes;

                if (oResponse != null && oResponse.ListOfRes != null)
                {
                    if (FetchedData.Count() == 0)
                    {
                        label1.Text = "Get Data Success: No reservations found!";
                    }
                    else
                    {
                        label1.Text = "Get Data Success:" + FetchedData.Count() + " reservations found!";
                    }
                }
                else
                {
                    label1.Text = " No Reservations found.";
                }
            }
            catch (Exception ex)
            {
                label1.Text = "Error: " + ex.Message;
            }
        }
Beispiel #22
0
        private void OnExportByAssetInStore(HttpContext context)
        {
            try
            {
                AssetInStore aisBll = new AssetInStore();
                var          list   = aisBll.GetListByJoin();
                if (list == null || list.Count == 0)
                {
                    context.Response.Write(ResResult.ResJsonString(false, "无数据", ""));
                    return;
                }
                var colAppend = "照片,资产条码,资产名称,资产类别,规格型号,SN号,计量单位,金额,使用公司,使用部门,使用人,区域,存放地点,管理员,所属公司,购入时间,供应商,使用期限";
                var cols      = colAppend.Split(',');
                var dt        = new DataTable("dtAssetInStore");
                foreach (var item in cols)
                {
                    dt.Columns.Add(new DataColumn(item, System.Type.GetType("System.String")));
                }
                foreach (var model in list)
                {
                    var dr = dt.NewRow();
                    for (var i = 0; i < cols.Length; i++)
                    {
                        var text = "";
                        switch (i)
                        {
                        case 0:
                            text = "";
                            break;

                        case 1:
                            text = model.Barcode;
                            break;

                        case 2:
                            text = model.Named;
                            break;

                        case 3:
                            text = model.CategoryName;
                            break;

                        case 4:
                            text = model.SpecModel;
                            break;

                        case 5:
                            text = model.SNCode;
                            break;

                        case 6:
                            text = model.Unit;
                            break;

                        case 7:
                            text = model.Price.ToString();
                            break;

                        default:
                            break;
                        }
                        dr[i] = text;
                    }
                    dt.Rows.Add(dr);
                }

                //NpoiHelper npoi = new NpoiHelper();
                //var fileUrl = npoi.ExportExcel(dt, "资产列表.xlsx");
                var fileUrl = "";

                context.Response.Write(ResResult.ResJsonString(true, "", fileUrl));
            }
            catch (Exception ex)
            {
                context.Response.Write(ResResult.ResJsonString(false, ex.Message, ""));
            }
        }
Beispiel #23
0
        private void ImportByAssetInStore(HttpContext context, HttpPostedFile file)
        {
            //NpoiHelper npoi = new NpoiHelper();
            //var dt = npoi.GetExcelData(Path.GetExtension(file.FileName), file.InputStream);
            var dt  = new DataTable();
            var drc = dt.Rows;

            if (drc.Count == 0)
            {
                context.Response.Write(ResResult.ResJsonString(false, "导入的数据不能为空字符串", ""));
                return;
            }
            Category cBll  = new Category();
            OrgDepmt odBll = new OrgDepmt();
            Region   rBll  = new Region();
            decimal  d     = decimal.MinValue;
            DateTime time  = DateTime.MinValue;
            var      list  = new List <AssetInStoreInfo>();

            foreach (DataRow dr in drc)
            {
                if (string.IsNullOrWhiteSpace(dr["资产条码"].ToString()) || string.IsNullOrWhiteSpace(dr["资产名称"].ToString()) || string.IsNullOrWhiteSpace(dr["资产类别编码"].ToString()) || string.IsNullOrWhiteSpace(dr["使用公司编码"].ToString()) || string.IsNullOrWhiteSpace(dr["存放地点"].ToString()) || string.IsNullOrWhiteSpace(dr["所属公司编码"].ToString()) || string.IsNullOrWhiteSpace(dr["购入时间"].ToString()))
                {
                    throw new ArgumentException("带有“*”的列为必填项,请正确操作");
                }
                var model = new AssetInStoreInfo();
                model.Barcode = dr["资产条码"].ToString();
                model.Named   = dr["资产名称"].ToString();
                var categoryModel = cBll.GetModelByCode(dr["资产类别编码"].ToString().Trim());
                if (categoryModel == null)
                {
                    throw new ArgumentException("资产类别编码“" + dr["资产类别编码"].ToString().Trim() + "”对应的数据不存在或已被删除");
                }
                model.CategoryId = categoryModel.Id;

                if (!decimal.TryParse(dr["金额"].ToString(), out d))
                {
                    throw new ArgumentException("金额“" + dr["金额"].ToString() + "”不正确");
                }
                model.Price     = d;
                model.SpecModel = dr["规格型号"].ToString();
                model.Unit      = dr["计量单位"].ToString();

                var useCompanyModel = odBll.GetModelByCode(dr["使用公司编码"].ToString());
                if (useCompanyModel == null)
                {
                    throw new ArgumentException("使用公司编码“" + dr["使用公司编码"].ToString() + "”对应的数据不存在或已被删除");
                }
                var orgdModel = odBll.GetModelByCode(dr["使用部门编码"].ToString());
                if (orgdModel == null)
                {
                    throw new ArgumentException("使用部门编码“" + dr["使用部门编码"].ToString() + "”对应的数据不存在或已被删除");
                }

                model.UseCompanyId = useCompanyModel.Id;
                model.UseDepmtId   = orgdModel.Id;

                var rModel = rBll.GetModelByCode(dr["区域编码"].ToString());
                if (rModel == null)
                {
                    throw new ArgumentException("区域编码“" + dr["区域编码"].ToString() + "”对应的数据不存在或已被删除");
                }
                model.RegionId = rModel.Id;

                var ownedCompanyModel = odBll.GetModelByCode(dr["所属公司编码"].ToString());
                if (ownedCompanyModel == null)
                {
                    throw new ArgumentException("所属公司编码“" + dr["所属公司编码"].ToString() + "”对应的数据不存在或已被删除");
                }
                model.OwnedCompanyId = ownedCompanyModel.Id;

                model.UsePerson     = dr["使用人"].ToString();
                model.StoreLocation = dr["存放地点"].ToString();
                model.Manager       = dr["管理员姓名"].ToString();
                if (!DateTime.TryParse(dr["购入时间"].ToString(), out time))
                {
                    throw new ArgumentException("购入时间“" + dr["购入时间"].ToString() + "”不正确");
                }
                model.BuyDate  = time;
                model.Supplier = dr["供应商"].ToString();
                model.Remark   = dr["备注"].ToString();
                model.SNCode   = dr["SN号"].ToString();

                model.UseExpireMonth  = 1200;
                model.PictureId       = Guid.Empty;
                model.LastUpdatedDate = DateTime.Now;

                list.Add(model);
            }

            AssetInStore aisBll = new AssetInStore();
            var          index  = 0;
            var          userId = WebCommon.GetUserId();

            foreach (var model in list)
            {
                model.UserId = userId;
                if (aisBll.Insert(model) < 1)
                {
                    throw new ArgumentException(string.Format("{0}", index > 0 ? "部分数据已经成功导入,但是执行到第“" + index + "”行时发生异常" : "数据导入失败,行“" + index + "”发生异常"));
                }
                index++;
            }
            context.Response.Write(ResResult.ResJsonString(true, "导入成功", ""));
        }
Beispiel #24
0
        /// <summary>
        /// 导入组织机构
        /// </summary>
        /// <param name="context"></param>
        private void OnImportOrgDepmt(HttpContext context)
        {
            var files = context.Request.Files;

            if (files.Count == 0)
            {
                throw new ArgumentException(MC.M_UploadFileNotExist);
            }

            var appCode = context.Request.Form["AppCode"];
            var userId  = WebCommon.GetUserId();
            var orgId   = new Staff().GetOrgId(userId);

            var bll    = new OrgDepmt();
            int effect = 0;

            var categories = bll.GetList();

            foreach (string item in files.AllKeys)
            {
                HttpPostedFile file = files[item];
                if (file == null || file.ContentLength == 0)
                {
                    continue;
                }
                var dt = ExcelHelper.Import(file.InputStream);
                if (dt == null || dt.Rows.Count == 0)
                {
                    throw new ArgumentException(MC.M_UploadFileDataNotExist);
                }
                var currTime = DateTime.Now;
                var sEmpty   = string.Empty;

                var drc = dt.Rows;
                foreach (DataRow dr in drc)
                {
                    #region 请求参数集

                    string coded = string.Empty;
                    if (dr["资产分类编码"] != null)
                    {
                        coded = dr["资产分类编码"].ToString().Trim();
                    }
                    string named = string.Empty;
                    if (dr["资产分类名称"] != null)
                    {
                        named = dr["资产分类名称"].ToString().Trim();
                    }
                    string parentCode = string.Empty;
                    if (dr["所属上级分类编码"] != null)
                    {
                        parentCode = dr["所属上级分类编码"].ToString().Trim();
                    }
                    string parentName = string.Empty;
                    if (dr["所属上级分类"] != null)
                    {
                        parentName = dr["所属上级分类"].ToString().Trim();
                    }
                    int sort = 0;
                    if (dr["排序"] != null)
                    {
                        int.TryParse(dr["排序"].ToString(), out sort);
                    }
                    if (string.IsNullOrWhiteSpace(coded) || string.IsNullOrWhiteSpace(named))
                    {
                        continue;
                    }

                    var id       = Guid.NewGuid();
                    var parentId = Guid.Empty;
                    if (string.IsNullOrWhiteSpace(parentCode))
                    {
                        parentCode = named;
                    }
                    var parentInfo = bll.GetModel(parentCode, parentName);
                    var step       = id.ToString();
                    var ids        = new List <Guid>();
                    if (parentInfo != null)
                    {
                        parentId = parentInfo.Id;
                        bll.GetStep(categories, parentId, ref ids);
                        if (ids.Count > 0)
                        {
                            Array.Reverse(ids.ToArray());
                            step += "," + string.Join(",", ids.ToArray());
                        }
                    }

                    var currInfo = new OrgDepmtInfo(id, appCode, userId, orgId, parentId, coded, named, step, sort, sEmpty, currTime, currTime);
                    effect += bll.Insert(currInfo);

                    #endregion
                }
            }
            if (effect < 1)
            {
                context.Response.Write(ResResult.ResJsonString(false, MC.M_Save_Error, ""));
            }
            else
            {
                context.Response.Write(ResResult.ResJsonString(true, MC.M_Save_Ok, effect));
            }
        }
Beispiel #25
0
        /// <summary>
        /// 导入资产信息
        /// </summary>
        /// <param name="context"></param>
        private void OnImportProduct(HttpContext context)
        {
            var files = context.Request.Files;

            if (files.Count == 0)
            {
                throw new ArgumentException(MC.M_UploadFileNotExist);
            }

            var appCode = context.Request.Form["AppCode"];
            var userId  = WebCommon.GetUserId();
            var orgId   = new Staff().GetOrgId(userId);

            var bll      = new Product();
            var orgBll   = new OrgDepmt();
            var spBll    = new StoragePlace();
            var cBll     = new Category();
            int effect   = 0;
            var currTime = DateTime.Now;

            foreach (string item in files.AllKeys)
            {
                HttpPostedFile file = files[item];
                if (file == null || file.ContentLength == 0)
                {
                    continue;
                }
                var dt = ExcelHelper.Import(file.InputStream);
                if (dt == null || dt.Rows.Count == 0)
                {
                    throw new CustomException(MC.M_UploadFileDataNotExist);
                }
                //var id = Guid.Empty;

                var drc = dt.Rows;
                foreach (DataRow dr in drc)
                {
                    var currInfo = new ProductInfo();

                    #region 请求参数集

                    if (dr["资产分类编码"] != null)
                    {
                        currInfo.CategoryCode = dr["资产分类编码"].ToString().Trim();
                    }
                    if (dr["资产分类"] != null)
                    {
                        currInfo.CategoryName = dr["资产分类"].ToString().Trim();
                    }

                    if (string.IsNullOrWhiteSpace(currInfo.CategoryCode) || string.IsNullOrWhiteSpace(currInfo.CategoryName))
                    {
                        throw new CustomException(MC.GetString(MC.Request_InvalidArgument, "资产编码、资产名称"));
                    }
                    var oldCategoryInfo = cBll.GetModel(currInfo.CategoryCode, currInfo.CategoryName);
                    if (oldCategoryInfo == null)
                    {
                        throw new CustomException(MC.GetString(MC.P_InvalidError, string.Format("资产分类编码“{0}”、资产分类为“{1}”", currInfo.CategoryCode, currInfo.CategoryName)));
                    }
                    currInfo.CategoryId = oldCategoryInfo.Id;

                    //if (dr["资产编码"] != null) currInfo.Coded = dr["资产编码"].ToString().Trim();
                    if (dr["资产名称"] != null)
                    {
                        currInfo.Named = dr["资产名称"].ToString().Trim();
                    }
                    //if (bll.IsExist(currInfo.Coded, currInfo.Named)) continue;
                    var sCoded = bll.GetRndCode(oldCategoryInfo.Coded, 8);
                    currInfo.Coded = sCoded;
                    var qty = 0;
                    if (dr["数量"] != null)
                    {
                        int.TryParse(dr["数量"].ToString(), out qty);
                    }
                    currInfo.Qty = 1;
                    if (qty < 1)
                    {
                        throw new CustomException(string.Format("数量为“{0}”", qty));
                    }
                    if (dr["规格型号"] != null)
                    {
                        currInfo.SpecModel = dr["规格型号"].ToString().Trim();
                    }
                    var price = 0m;
                    if (dr["单价"] != null && decimal.TryParse(dr["单价"].ToString(), out price))
                    {
                        currInfo.Price = price;
                    }
                    var amount = 0m;
                    if (dr["金额"] != null && decimal.TryParse(dr["金额"].ToString(), out amount))
                    {
                        currInfo.Amount = amount;
                    }
                    if (dr["计量单位"] != null)
                    {
                        currInfo.MeterUnit = dr["计量单位"].ToString().Trim();
                    }
                    var pieceQty = 0;
                    //if (dr["件数"] != null && int.TryParse(dr["件数"].ToString(),out pieceQty)) currInfo.PieceQty = pieceQty;
                    if (dr["资产属性"] != null)
                    {
                        currInfo.Pattr = dr["资产属性"].ToString().Trim();
                    }
                    if (dr["资产来源"] != null)
                    {
                        currInfo.SourceFrom = dr["资产来源"].ToString().Trim();
                    }
                    if (dr["供应商"] != null)
                    {
                        currInfo.Supplier = dr["供应商"].ToString().Trim();
                    }
                    var buyDate = DateTime.MinValue;
                    if (dr["购入日期"] != null)
                    {
                        DateTime.TryParse(dr["购入日期"].ToString(), out buyDate);
                    }
                    if (buyDate == DateTime.MinValue)
                    {
                        buyDate = DateTime.Parse("1754-01-01");
                    }
                    currInfo.BuyDate = buyDate;
                    var enableDate = DateTime.MinValue;
                    if (dr["启用日期"] != null && DateTime.TryParse(dr["启用日期"].ToString(), out enableDate))
                    {
                        currInfo.EnableDate = enableDate.ToString("yyyy-MM-dd");
                    }
                    if (dr["使用期限"] != null)
                    {
                        currInfo.UseDateLimit = dr["使用期限"].ToString().Trim();
                    }
                    if (dr["使用部门"] != null)
                    {
                        currInfo.UseOrgName = dr["使用部门"].ToString().Trim();
                    }
                    if (dr["使用部门编码"] != null)
                    {
                        currInfo.UseOrgCode = dr["使用部门编码"].ToString().Trim();
                    }
                    if (!string.IsNullOrEmpty(currInfo.UseOrgCode) || !string.IsNullOrEmpty(currInfo.UseOrgName))
                    {
                        var useOrgInfo = orgBll.GetModel(currInfo.UseOrgCode, currInfo.UseOrgName);
                        if (useOrgInfo == null)
                        {
                            throw new CustomException(MC.GetString(MC.P_InvalidError, string.Format("使用部门编码“{0}”、使用部门“{1}”", currInfo.UseOrgCode, currInfo.UseOrgName)));
                        }
                        currInfo.UseDepmtId = useOrgInfo.Id;
                    }

                    if (dr["实物管理部门"] != null)
                    {
                        currInfo.MgrOrgName = dr["实物管理部门"].ToString().Trim();
                    }
                    if (dr["实物管理部门编码"] != null)
                    {
                        currInfo.MgrOrgCode = dr["实物管理部门编码"].ToString().Trim();
                    }
                    if (!string.IsNullOrEmpty(currInfo.MgrOrgCode) || !string.IsNullOrEmpty(currInfo.MgrOrgName))
                    {
                        var mgrOrgInfo = orgBll.GetModel(currInfo.MgrOrgCode, currInfo.MgrOrgName);
                        if (mgrOrgInfo == null)
                        {
                            throw new CustomException(MC.GetString(MC.P_InvalidError, string.Format("实物管理部门编码“{0}”、实物管理部门“{1}”", currInfo.MgrOrgCode, currInfo.MgrOrgName)));
                        }
                        currInfo.MgrDepmtId = mgrOrgInfo.Id;
                    }

                    if (dr["存放地点"] != null)
                    {
                        currInfo.StoragePlaceName = dr["存放地点"].ToString().Trim();
                    }
                    if (dr["存放地点编码"] != null)
                    {
                        currInfo.StoragePlaceCode = dr["存放地点编码"].ToString().Trim();
                    }
                    if (!string.IsNullOrEmpty(currInfo.StoragePlaceCode) || !string.IsNullOrEmpty(currInfo.StoragePlaceName))
                    {
                        var storagePlaceInfo = spBll.GetModel(currInfo.StoragePlaceCode, currInfo.StoragePlaceName);
                        if (storagePlaceInfo == null)
                        {
                            throw new CustomException(MC.GetString(MC.P_InvalidError, string.Format("存放地点编码“{0}”、存放地点“{1}”", currInfo.StoragePlaceCode, currInfo.StoragePlaceName)));
                        }
                        currInfo.StoragePlaceId = storagePlaceInfo.Id;
                    }

                    if (dr["使用人"] != null)
                    {
                        currInfo.UsePersonName = dr["使用人"].ToString().Trim();
                    }

                    #endregion

                    currInfo.AppCode         = appCode;
                    currInfo.UserId          = userId;
                    currInfo.DepmtId         = orgId;
                    currInfo.RecordDate      = currTime;
                    currInfo.LastUpdatedDate = currTime;

                    effect += bll.Insert(currInfo);

                    if (qty > 1)
                    {
                        for (var i = 1; i < qty; i++)
                        {
                            currInfo.Coded = bll.GetRndCode(sCoded, 11);
                            effect        += bll.Insert(currInfo);
                        }
                    }
                }
            }
            if (effect < 1)
            {
                context.Response.Write(ResResult.ResJsonString(false, MC.M_Save_Error, ""));
            }
            else
            {
                context.Response.Write(ResResult.ResJsonString(true, MC.M_Save_Ok, effect));
            }
        }
Beispiel #26
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json; charset=utf-8";
            try
            {
                string reqName = "";
                switch (context.Request.HttpMethod.ToUpper())
                {
                case "GET":
                    reqName = context.Request.QueryString["ReqName"];
                    break;

                case "POST":
                    reqName = context.Request.Form["ReqName"];
                    break;

                default:
                    break;
                }
                if (string.IsNullOrWhiteSpace(reqName))
                {
                    return;
                }
                reqName = reqName.Trim();

                switch (reqName)
                {
                case "ImportStoragePlace":
                    OnImportStoragePlace(context);
                    break;

                case "ExportStoragePlace":
                    OnExportStoragePlace(context);
                    break;

                case "ImportOrgDepmt":
                    OnImportOrgDepmt(context);
                    break;

                case "ExportOrgDepmt":
                    OnExportOrgDepmt(context);
                    break;

                case "ImportCategory":
                    OnImportCategory(context);
                    break;

                case "ExportCategory":
                    OnExportCategory(context);
                    break;

                case "ImportProduct":
                    OnImportProduct(context);
                    break;

                case "ExportProduct":
                    OnExportProduct(context);
                    break;

                case "ExportPandianAsset":
                    OnExportPandianAsset(context);
                    break;

                default:
                    throw new ArgumentException(MC.Request_Params_InvalidError);
                }
            }
            catch (CustomException ex)
            {
                context.Response.Write(ResResult.ResJsonString(false, ex.Message, ""));
            }
            catch (Exception ex)
            {
                context.Response.Write(ResResult.ResJsonString(false, ex.Message, ""));
            }
        }
Beispiel #27
0
        /// <summary>
        /// 导入存放地点
        /// </summary>
        /// <param name="context"></param>
        private void OnImportStoragePlace(HttpContext context)
        {
            var files = context.Request.Files;

            if (files.Count == 0)
            {
                throw new ArgumentException(MC.M_UploadFileNotExist);
            }

            var appCode = context.Request.Form["AppCode"];
            var userId  = WebCommon.GetUserId();
            var orgId   = new Staff().GetOrgId(userId);

            var bll    = new StoragePlace();
            int effect = 0;

            foreach (string item in files.AllKeys)
            {
                HttpPostedFile file = files[item];
                if (file == null || file.ContentLength == 0)
                {
                    continue;
                }
                var dt = ExcelHelper.Import(file.InputStream);
                if (dt == null || dt.Rows.Count == 0)
                {
                    throw new ArgumentException(MC.M_UploadFileDataNotExist);
                }
                var currTime = DateTime.Now;
                var id       = Guid.Empty;

                var drc = dt.Rows;
                foreach (DataRow dr in drc)
                {
                    #region 请求参数集

                    string coded = string.Empty;
                    if (dr["存放地点编码"] != null)
                    {
                        coded = dr["存放地点编码"].ToString().Trim();
                    }
                    string named = string.Empty;
                    if (dr["存放地点"] != null)
                    {
                        named = dr["存放地点"].ToString().Trim();
                    }

                    if (!string.IsNullOrWhiteSpace(named))
                    {
                        if (string.IsNullOrWhiteSpace(coded))
                        {
                            coded = bll.GetRndCode(6);
                        }
                        if (bll.GetModel(null, named) != null)
                        {
                            continue;
                        }
                        var currInfo = new StoragePlaceInfo(id, appCode, userId, orgId, coded, named, currTime, currTime);
                        effect += bll.Insert(currInfo);
                    }

                    #endregion
                }
            }
            if (effect < 1)
            {
                context.Response.Write(ResResult.ResJsonString(false, MC.M_Save_Error, ""));
            }
            else
            {
                context.Response.Write(ResResult.ResJsonString(true, MC.M_Save_Ok, effect));
            }
        }
Beispiel #28
0
        private void GetInfoneDeviceRepairRecordList(HttpContext context, int pageIndex, int pageSize, string keyword)
        {
            var           bll         = new InfoneDeviceRepairRecord();
            int           totalRecord = 0;
            StringBuilder sqlWhere    = null;
            ParamsHelper  parms       = null;
            SqlParameter  parm        = null;

            if (!string.IsNullOrWhiteSpace(keyword))
            {
                if (sqlWhere == null)
                {
                    sqlWhere = new StringBuilder(2000);
                }
                if (parms == null)
                {
                    parms = new ParamsHelper();
                }

                sqlWhere.Append(@"and (drr.Customer like @Keyword or drr.SerialNumber like @Keyword 
                                       or drr.DeviceModel like @Keyword or drr.FaultCause like @Keyword or drr.SolveMethod like @Keyword
                                       or drr.CustomerProblem like @Keyword or drr.DevicePart like @Keyword or drr.TreatmentSituation like @Keyword
                                       or drr.HandoverPerson like @Keyword or drr.RegisteredPerson like @Keyword or drr.Remark like @Keyword) ");

                parm       = new SqlParameter("@Keyword", SqlDbType.NVarChar, 50);
                parm.Value = "%" + keyword + "%";
                parms.Add(parm);
            }
            DateTime startDate = DateTime.MinValue;
            DateTime endDate   = DateTime.MinValue;

            if (!string.IsNullOrWhiteSpace(context.Request.Form["StartDate"]))
            {
                DateTime.TryParse(context.Request.Form["StartDate"], out startDate);
            }
            if (!string.IsNullOrWhiteSpace(context.Request.Form["EndDate"]))
            {
                DateTime.TryParse(context.Request.Form["EndDate"], out endDate);
            }

            if (startDate != DateTime.MinValue && endDate != DateTime.MinValue)
            {
                if (sqlWhere == null)
                {
                    sqlWhere = new StringBuilder(1000);
                }
                if (parms == null)
                {
                    parms = new ParamsHelper();
                }

                sqlWhere.Append(@"and (drr.RecordDate between @StartDate and @EndDate) ");
                parm       = new SqlParameter("@StartDate", SqlDbType.DateTime);
                parm.Value = startDate;
                parms.Add(parm);
                parm       = new SqlParameter("@EndDate", SqlDbType.DateTime);
                parm.Value = DateTime.Parse(endDate.ToString("yyyy-MM-dd") + " 23:59:59");
                parms.Add(parm);
            }
            else
            {
                if (startDate != DateTime.MinValue)
                {
                    if (sqlWhere == null)
                    {
                        sqlWhere = new StringBuilder(1000);
                    }
                    if (parms == null)
                    {
                        parms = new ParamsHelper();
                    }

                    sqlWhere.Append(@"and (drr.RecordDate >= @StartDate) ");
                    parm       = new SqlParameter("@StartDate", SqlDbType.DateTime);
                    parm.Value = startDate;
                    parms.Add(parm);
                }
                if (endDate != DateTime.MinValue)
                {
                    if (sqlWhere == null)
                    {
                        sqlWhere = new StringBuilder(1000);
                    }
                    if (parms == null)
                    {
                        parms = new ParamsHelper();
                    }

                    sqlWhere.Append(@"and (drr.RecordDate <= @EndDate) ");
                    parm       = new SqlParameter("@EndDate", SqlDbType.DateTime);
                    parm.Value = DateTime.Parse(endDate.ToString("yyyy-MM-dd") + " 23:59:59");
                    parms.Add(parm);
                }
            }

            var backDate = DateTime.MinValue;

            if (!string.IsNullOrWhiteSpace(context.Request.Form["BackDate"]))
            {
                DateTime.TryParse(context.Request.Form["BackDate"], out backDate);
            }
            if (backDate != DateTime.MinValue)
            {
                if (sqlWhere == null)
                {
                    sqlWhere = new StringBuilder(500);
                }
                if (parms == null)
                {
                    parms = new ParamsHelper();
                }

                sqlWhere.Append(@"and drr.BackDate = @BackDate ");
                parm       = new SqlParameter("@BackDate", SqlDbType.DateTime);
                parm.Value = backDate;
                parms.Add(parm);
            }
            if (!string.IsNullOrWhiteSpace(context.Request.Form["WhetherFix"]))
            {
                if (sqlWhere == null)
                {
                    sqlWhere = new StringBuilder(300);
                }
                if (parms == null)
                {
                    parms = new ParamsHelper();
                }

                sqlWhere.Append(@"and drr.WhetherFix = @WhetherFix ");
                parm       = new SqlParameter("@WhetherFix", SqlDbType.NVarChar, 20);
                parm.Value = HttpUtility.UrlDecode(context.Request.Form["WhetherFix"].Trim());
                parms.Add(parm);
            }
            if (!string.IsNullOrWhiteSpace(context.Request.Form["IsBack"]))
            {
                if (sqlWhere == null)
                {
                    sqlWhere = new StringBuilder(50);
                }
                if (parms == null)
                {
                    parms = new ParamsHelper();
                }

                sqlWhere.Append(@"and drr.IsBack = @IsBack ");
                parm       = new SqlParameter("@IsBack", SqlDbType.Bit);
                parm.Value = context.Request.Form["IsBack"].Trim() == "1";
                parms.Add(parm);
            }
            var list = bll.GetListByJoin(pageIndex, pageSize, out totalRecord, sqlWhere == null ? "" : sqlWhere.ToString(), parms == null ? null : parms.ToArray());

            context.Response.Write(ResResult.ResJsonString(true, "", "{\"total\":" + totalRecord + ",\"rows\":" + JsonConvert.SerializeObject(list) + "}"));
        }
Beispiel #29
0
        public void GetInfoneProjectReportPrepareInfo(HttpContext context, Guid Id)
        {
            var bll = new InfoneProjectReportPrepare();

            context.Response.Write(ResResult.ResJsonString(true, "", JsonConvert.SerializeObject(bll.GetModelByJoin(Id))));
        }
Beispiel #30
0
        public void GetInfoneCustomerInfo(HttpContext context, Guid Id)
        {
            var bll = new InfoneCustomer();

            context.Response.Write(ResResult.ResJsonString(true, "", JsonConvert.SerializeObject(bll.GetModel(Id))));
        }