public JsonResult Get(SchoolSearchParam param)
        {
            var list = service.Fetch(param);

            return(Json(ResultUtil.Success <IEnumerable <SchoolEntity> >(list)));
        }
示例#2
0
        public string AddOrUpdatePanorama(string json)
        {
            try
            {
                JObject jo = JsonConvert.DeserializeObject(json) as JObject;
                //声明更新用的sql
                StringBuilder sql   = new StringBuilder();
                StringBuilder sqlmy = new StringBuilder(@"SELECT * FROM `panorama`");

                //查询所有字段的字段名dt2,sqlmy
                //存在id则update否则insert dtr,dt,sql2
                DataTable dt2 = ResultUtil.getDataTable(sqlmy.ToString());
                JToken    jid = jo["id"];
                if (jid != null)
                {
                    string id = jo["id"].ToString();
                    sql.Append(string.Format(@"update `panorama` set "));
                    foreach (KeyValuePair <string, JToken> kyp in jo)
                    {
                        foreach (DataColumn dc in dt2.Columns)
                        {
                            if (kyp.Key.Equals(dc.ColumnName) && !string.IsNullOrEmpty(kyp.Value.ToString()))
                            {
                                sql.Append(string.Format(@"{0}={1},", kyp.Key, string.Format(@"'{0}'", kyp.Value)));
                            }
                        }
                    }
                    string sqls    = sql.ToString();
                    string sqlsnew = sqls.Remove(sqls.Length - 1);
                    sqlsnew = sqlsnew + " where id=" + id + ";";
                    //执行sql
                    ResultUtil.insOrUpdOrDel(sqlsnew);
                    result = ResultUtil.getStandardResult((int)Status.Normal, EnumUtil.getMessageStr((int)Message.Update), @"success,SQL" + sqlsnew);
                }
                else
                {
                    sql.Append(string.Format(@"insert into `panorama` set "));
                    foreach (KeyValuePair <string, JToken> kyp in jo)
                    {
                        foreach (DataColumn dc in dt2.Columns)
                        {
                            if (kyp.Key.Equals(dc.ColumnName) && !string.IsNullOrEmpty(kyp.Value.ToString()))
                            {
                                sql.Append(string.Format(@"{0}={1},", kyp.Key, string.Format(@"'{0}'", kyp.Value)));
                            }
                        }
                    }
                    string sqls    = sql.ToString();
                    string sqlsnew = sqls.Remove(sqls.Length - 1);
                    //执行sql
                    ResultUtil.insOrUpdOrDel(sqlsnew);
                    result = ResultUtil.getStandardResult((int)Status.Normal, EnumUtil.getMessageStr((int)Message.Insert), @"success,SQL" + sqlsnew);
                }
            }
            catch (Exception ex)
            {
                //异常日志
                LogHelper.WriteError("注册异常:" + ex.Message);
                //异常结果
                result = ResultUtil.getStandardResult((int)Status.Error, EnumUtil.getMessageStr((int)Message.InsertFailure), ex.Message);
            }
            return(result);
        }
        public ActionResult Get(UserSearchParam param)
        {
            var users = _service.Fetch(param);

            return(Json(ResultUtil.Success(users)));
        }
示例#4
0
        public JsonResult Get(AppUserSearchParam param)
        {
            var list = service.Fetch(param.ToSearchUtil());

            return(Json(ResultUtil.List <AppUserEntity>(list)));
        }
示例#5
0
        public async Task <Result> ShowDetail(int id)
        {
            var speech = await db.speeches.SingleOrDefaultAsync(t => t.id == id);

            return(ResultUtil.Success(new SpeechWrapper(speech)));
        }
示例#6
0
        public ActionResult Get(StockItemSearchParam param, int pageIndex = 1, int pageSize = 20)
        {
            var items = _stockService.PageListItems(param, pageIndex, pageSize);

            return(Json(ResultUtil.PageList(items)));
        }
示例#7
0
        public JsonResult GetWeixinDepts()
        {
            var list = _weixinDeptUtil.All();

            return(Json(ResultUtil.Success(list)));
        }
示例#8
0
        public JsonResult Get(DataItemSearchParam param, int pageIndex = 1, int pageSize = 20)
        {
            var list = service.Fetch(param.ToSearchUtil());

            return(Json(ResultUtil.Success <IEnumerable <DataItemEntity> >(list)));
        }
示例#9
0
 public Result UpdateLastRecord(int year, int month)
 {
     return(ResultUtil.Success());
 }
        public JsonResult Get(ServiceApplySearchParam param, int pageIndex = 1, int pageSize = 20)
        {
            var pageList = _service.PageList(pageIndex, pageSize, param);

            return(Json(ResultUtil.PageList(pageList)));
        }
示例#11
0
        public JsonResult ReceiptDelete(List <int> ids)
        {
            var result = ResultUtil.success("删除成功!");

            return(Json(result, "application/json"));
        }
示例#12
0
        public JsonResult Get(int pageIndex, int pageSize, bool?isFinish = null, string key = "")
        {
            var list = _service.Query(pageIndex, pageSize, isFinish, key);

            return(Json(ResultUtil.PageList(list)));
        }
示例#13
0
        public JsonResult Get()
        {
            var menus = MenuUtil.All();

            return(Json(ResultUtil.Success(menus)));
        }
示例#14
0
        public ActionResult Get()
        {
            var deptList = AssetCateUtil.All();

            return(Json(ResultUtil.Success <List <AssetCateDto> >(deptList)));
        }
示例#15
0
        public async Task <Result> ShowDetail(int id)
        {
            var notice = await db.notices.SingleOrDefaultAsync(t => t.id == id);

            return(ResultUtil.Success(notice));
        }
示例#16
0
 public string getUsername()
 {
     userinfo = TokenUtil.getToken();
     return(ResultUtil.success(userinfo.user_code, "查询成功"));
 }
示例#17
0
        public JsonResult Delete(List <string> ids)
        {
            var result = ResultUtil.success("ɾ³ý³É¹¦£¡");

            return(Json(result, "application/json"));
        }
示例#18
0
 public string getDepartment()
 {
     userinfo = TokenUtil.getToken();
     return(ResultUtil.success(userinfo.department_name, "查询成功"));
 }
示例#19
0
        public JsonResult GetWeixinUsers()
        {
            var list = WeixinUserUtil.All();

            return(Json(ResultUtil.Success(list)));
        }
示例#20
0
        public Result Create(OrderCreateDto entity, SchoolUser user)
        {
            string error;

            #region 检验 订单
            error = ValidNewOrder(entity, user);
            if (!string.IsNullOrWhiteSpace(error))
            {
                return(ResultUtil.Fail(error));
            }
            #endregion

            #region 检验订单明细
            error = ValidNewOrderDetails(entity.Details, user);
            if (!string.IsNullOrWhiteSpace(error))
            {
                return(ResultUtil.Fail(error));
            }
            #endregion

            #region 检验订单金额
            int originTotal = entity.Details.Sum(i => i.OriginUnitPrice * i.GoodsCount);
            int closingCost = entity.Details.Sum(i => i.ClosingUnitPrice * i.GoodsCount);

            if (closingCost != entity.ClosingCost)
            {
                return(ResultUtil.Fail("订单总额与订单明细不匹配"));
            }
            #endregion

            var order = Mapper.Map <OrderEntity>(entity);
            order.SchoolId = user.SchoolId;
            order.BeforeCreate(user);

            List <OrderDetailsEntity> details = new List <OrderDetailsEntity>();
            using (var conn = db.GetConnection())
            {
                conn.Open();
                using (var trans = conn.BeginTransaction())
                {
                    try
                    {
                        // 创建订单
                        var orderId = db.Create(order);

                        // 创建明细
                        foreach (var detail in entity.Details)
                        {
                            var temp = Mapper.Map <OrderDetailsEntity>(detail);
                            temp.OrderId = orderId;
                            temp.BeforeCreate(user);
                            details.Add(temp);
                        }
                        db.Create(details);

                        if (order.ActualPayment > 0)
                        {
                            // 创建付款记录
                            var payment = new PaymentEntity
                            {
                                SchoolId      = user.SchoolId,
                                StudentId     = entity.StudentId,
                                StudentName   = entity.StudentName,
                                OrderId       = orderId,
                                PaymentMethod = entity.PaymentMethod,
                                PaymentAmount = entity.ActualPayment
                            };
                            payment.BeforeCreate(user);

                            db.Create(payment);
                        }

                        trans.Commit();
                        return(ResultUtil.Success());
                    }
                    catch (Exception ex)
                    {
                        trans.Rollback();
                        return(ResultUtil.Exception(ex));
                    }
                }
            }
        }
示例#21
0
        public IActionResult Template(int year, int month)
        {
            try
            {
                MonthReportSearchParam param = new MonthReportSearchParam();
                param.Year  = year;
                param.Month = month;
                var list = service.GetSecurityList(param);

                string folderName     = DateTime.Today.ToString("yyyyMM");
                string fileName       = $"证券事务部-{year}{month}.xlsx";
                string baseFolderName = $"{Directory.GetCurrentDirectory()}//wwwroot//template";
                if (!Directory.Exists(baseFolderName))
                {
                    Directory.CreateDirectory(baseFolderName);
                }
                string savePath = $"{baseFolderName}//{fileName}";

                if (System.IO.File.Exists(savePath))
                {
                    System.IO.File.Delete(savePath);
                }

                using (ExcelPackage package = new ExcelPackage(new System.IO.FileInfo(savePath)))
                {
                    ExcelWorksheet workSheet = package.Workbook.Worksheets.Add("sheet1");
                    workSheet.Cells.Style.Font.Name           = "microsoft yahei";
                    workSheet.Cells.Style.Font.Size           = 9;
                    workSheet.Cells.Style.VerticalAlignment   = ExcelVerticalAlignment.Center;
                    workSheet.Cells.Style.HorizontalAlignment = ExcelHorizontalAlignment.Left;

                    workSheet.Cells[1, 1, 1, 8].Style.Border.Top.Style    = ExcelBorderStyle.Thin;
                    workSheet.Cells[1, 1, 1, 8].Style.Border.Left.Style   = ExcelBorderStyle.Thin;
                    workSheet.Cells[1, 1, 1, 8].Style.Border.Right.Style  = ExcelBorderStyle.Thin;
                    workSheet.Cells[1, 1, 1, 8].Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
                    workSheet.Cells[1, 1, 1, 8].Style.Border.BorderAround(ExcelBorderStyle.Thin, Color.Black);

                    int rowIndex = 1;
                    workSheet.Cells[1, 1, 1, 8].Style.Fill.PatternType = ExcelFillStyle.Solid;
                    workSheet.Cells[1, 1, 1, 8].Style.Fill.BackgroundColor.SetColor(Color.Yellow);

                    workSheet.Cells[rowIndex, 1].Value = "编号";
                    workSheet.Cells[rowIndex, 2].Value = "年";
                    workSheet.Cells[rowIndex, 3].Value = "月";
                    workSheet.Cells[rowIndex, 4].Value = "部门";
                    workSheet.Cells[rowIndex, 5].Value = "员工编号";
                    workSheet.Cells[rowIndex, 6].Value = "业务员";
                    workSheet.Cells[rowIndex, 7].Value = "职位";
                    workSheet.Cells[rowIndex, 8].Value = "服务费";

                    workSheet.Row(rowIndex).Height = 28;

                    rowIndex++;

                    foreach (var report in list)
                    {
                        workSheet.Cells[rowIndex, 1].Value = report.Id;
                        workSheet.Cells[rowIndex, 2].Value = report.Year;
                        workSheet.Cells[rowIndex, 3].Value = report.Month;
                        workSheet.Cells[rowIndex, 4].Value = report.DeptName;
                        workSheet.Cells[rowIndex, 5].Value = report.EmployeeNumber;
                        workSheet.Cells[rowIndex, 6].Value = report.SalerName;
                        workSheet.Cells[rowIndex, 7].Value = report.Job;
                        workSheet.Cells[rowIndex, 8].Value = report.FWF;

                        workSheet.Cells[rowIndex, 1, rowIndex, 8].Style.Border.Top.Style    = ExcelBorderStyle.Thin;
                        workSheet.Cells[rowIndex, 1, rowIndex, 8].Style.Border.Left.Style   = ExcelBorderStyle.Thin;
                        workSheet.Cells[rowIndex, 1, rowIndex, 8].Style.Border.Right.Style  = ExcelBorderStyle.Thin;
                        workSheet.Cells[rowIndex, 1, rowIndex, 8].Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
                        workSheet.Cells[rowIndex, 1, rowIndex, 8].Style.HorizontalAlignment = ExcelHorizontalAlignment.Left;
                        workSheet.Cells[rowIndex, 1, rowIndex, 8].Style.Border.BorderAround(ExcelBorderStyle.Thin, Color.Black);

                        workSheet.Row(rowIndex).Height = 24;
                        rowIndex++;
                    }

                    package.Save();
                    return(Redirect($"~/template/{HttpUtility.UrlEncode(fileName)}"));
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message, ex);
                return(Json(ResultUtil.Fail()));
            }
        }
示例#22
0
        public JsonResult Get(SalerSearchParam param, int pageIndex = 1, int pageSize = 20)
        {
            var list = service.Query(param.ToSearchUtil(), pageIndex, pageSize);

            return(Json(ResultUtil.PageList <SalerEntity>(list)));
        }