Ejemplo n.º 1
0
        /// <summary>
        /// 添加数据
        /// </summary>
        /// <param name="ComplaInfoJson"></param>
        /// <returns></returns>
        public string ComplaInfoAdd(string ComplaInfoJson)
        {
            //Json转实体类
            ComplaInfoInputDTO complaInfo = JsonConvert.DeserializeObject <ComplaInfoInputDTO>(ComplaInfoJson);

            complaInfo.AdminID = Session["AdminID"].ToString();
            //添加数据
            if (ComplaInfoService.DTOAdd(complaInfo))
            {
                return("ok");
            }
            else
            {
                return("no");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 添加数据
        /// </summary>
        /// <param name="User_ComplaInfoJson">前端返回的JSON数据</param>
        /// <returns></returns>
        public string User_ComplaInfoAdd(string User_ComplaInfoJson)
        {
            ComplaInfoInputDTO complaInfoInput = JsonConvert.DeserializeObject <ComplaInfoInputDTO>(User_ComplaInfoJson);
            string             HousID          = Session["HousID"].ToString();
            HouseInfo          list            = HouseInfoService.GetList(HousID);

            complaInfoInput.HousID = list.HousID;
            //添加数据
            if (ComplaInfoService.DTOAdd(complaInfoInput))
            {
                return("ok");
            }
            else
            {
                return("no");
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// DTO添加数据
        /// </summary>
        /// <param name="inputEntity"></param>
        /// <returns></returns>
        public bool DTOAdd(ComplaInfoInputDTO inputEntity)
        {
            //AutoMapper转换
            ComplaInfo dataModel = Mapper.Map <ComplaInfoInputDTO, ComplaInfo>(inputEntity);

            HouseInfo list = houseInfoDAL.LoadEntities(u => u.HousID == dataModel.HousID).FirstOrDefault();

            dataModel.ComplaID    = CreateOrderCode();
            dataModel.State       = 2;
            dataModel.RsubmitData = DateTime.Now;
            dataModel.UserID      = list.UserID;
            //ComplaInfo entity = complaInfoDAL.LoadEntities(u => u.HousID == HousID).FirstOrDefault();
            if (complaInfoDAL.AddAndSaveChange(dataModel) > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }