예제 #1
0
 private void Save_Callback(CommonResponse response)
 {
     this.CollectData(House);
     if (Take_Callback != null) Take_Callback.Invoke(House, null);
     SOAFramework.Client.Controls.MessageBox.Show(this, "收房成功");
     this.Close();
 }
예제 #2
0
 private void Save_Callback(CommonResponse reponse)
 {
     this.CollectData<Customer>(this.Customer);
     if (Edit_Callback != null) Edit_Callback.Invoke(reponse, null);
     SOAFramework.Client.Controls.MessageBox.Show(this, "保存成功");
     this.Close();
 }
예제 #3
0
 private void Save_Callback(CommonResponse response)
 {
     this.CollectData<FullUser>(User);
     if (SaveCallback != null) SaveCallback.Invoke(User, null);
     SOAFramework.Client.Controls.MessageBox.Show(this, "保存成功");
     this.Close();
 }
예제 #4
0
 private void BtnSave_ClickCallback(CommonResponse response)
 {
     if (SaveClickCallBack != null)
     {
         SaveClickCallBack.Invoke(Building, null);
         this.Close();
     }
 }
예제 #5
0
 private void Save_Callback(CommonResponse response)
 {
     this.CollectData(Role);
     Role.Authority = _tmpRole.Authority;
     Role.Menus = _tmpRole.Menus;
     if (Edit_Callback != null) Edit_Callback.Invoke(Role, null);
     SOAFramework.Client.Controls.MessageBox.Show(this, "保存成功");
     this.Close();
 }
예제 #6
0
 private void UpdateCallBack(CommonResponse response)
 {
     this.CollectData<FullHouse>(House);
     //this.Building.CurrentHouse.House.IsRented = this.Building.CurrentHouse
     House.Building = (cmbBuilding.SelectedItem as Building).Clone<Building>();
     if (Update_Callback != null) Update_Callback.Invoke(House, null);
     SOAFramework.Client.Controls.MessageBox.Show(this, "更新成功");
     this.Close();
 }
        public CommonResponse ValiTokenState(string access_token)
        {
            var ret = new CommonResponse
            {
                TokenInfo = new TnToken()
            };
            string    Issuer    = Configuration.GetSection("JWTConfig").GetSection("Issuer").Value;
            string    Audience  = Configuration.GetSection("JWTConfig").GetSection("Audience").Value;
            string    username  = "";
            TokenType tokenType = tokenHelper.ValiTokenState(access_token, a => a["iss"] == Issuer && a["aud"] == Audience, action => { username = action["username"]; });

            if (tokenType == TokenType.Fail)
            {
                ret.Code    = 202;
                ret.Message = "token验证失败";
                return(ret);
            }
            if (tokenType == TokenType.Expired)
            {
                ret.Code    = 205;
                ret.Message = "token已经过期";
                return(ret);
            }

            //..............其他逻辑
            var data = new List <Dictionary <string, string> >();
            var bb   = new Dictionary <string, string>
            {
                { "wanghzen", "123456" }
            };

            data.Add(bb);
            ret.Code    = 200;
            ret.Message = "访问成功!";
            ret.Data    = data;
            return(ret);
        }
예제 #8
0
        public static async Task <CommonResponse> Register(UserModel user, string password)
        {
            var    response = new CommonResponse();
            string passwordHash, passwordSalt;

            GeneratePasswordHash(password, out passwordHash, out passwordSalt);

            user.Password = passwordHash;
            user.Salt     = passwordSalt;

            try
            {
                using (SqlConnection dbConn = new SqlConnection(connectionString))
                {
                    dbConn.Open();
                    String     SQL = GetUserInsertQuery(user);
                    SqlCommand cmd = new SqlCommand();
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = SQL;
                    cmd.Connection  = dbConn;
                    cmd.ExecuteNonQuery();

                    dbConn.Close();
                }


                response.IsError = false;
            }
            catch (Exception ex)
            {
                response.IsError = true;
                response.Message = "Error in Registering User!";
            }

            return(response);
        }
예제 #9
0
 public void TS_Tobk(Auth auth, Tobk request, Tobk_Logic tobk_Logic, CommonResponse ecr, string[] token, string uri)
 {
     if (auth.AuthResult(token, uri))
     {
         if (uri.IndexOf("/tms/tobk1/sps") > 0)
         {
             ecr.data.results = tobk_Logic.Get_Tobk1_SpsList(request);
         }
         else if (uri.IndexOf("/tms/tobk1/update") > 0)
         {
             ecr.data.results = tobk_Logic.update_tobk1(request);
         }
         else if (uri.IndexOf("/tms/tobk1/confirm") > 0)
         {
             ecr.data.results = tobk_Logic.confirm_tobk1(request);
         }
         else if (uri.IndexOf("/tms/tobk1") > 0)
         {
             ecr.data.results = tobk_Logic.Get_Tobk1_List(request);
         }
         else if (uri.IndexOf("/tms/tobk2") > 0)
         {
             ecr.data.results = tobk_Logic.Get_Tobk2_List(request);
         }
         else
         {
             ecr.meta.code = 200;
         }
         ecr.meta.message = "OK";
     }
     else
     {
         ecr.meta.code    = 401;
         ecr.meta.message = "Unauthorized";
     }
 }
예제 #10
0
        public JsonResult AddCategory([FromBody] EmpCategory category)
        {
            CommonResponse cr = new CommonResponse();

            try
            {
                var isExist = DataAccess.Instance.CommonServices.IsExist("Emp_Category", "CategoryName = '" + category.CategoryName + "' ");
                if (isExist)
                {
                    throw new Exception("Category Already Exist.");
                }
                category.AddDate = DateTime.Now;
                category.AddBy   = User.Identity.Name;
                category.SetDate();
                _context.EmpCategory.Add(category);
                _context.SaveChanges();
            }
            catch (Exception ex)
            {
                cr.message = ex.Message;
                cr.results = Constant.FAILED;
            }
            return(new JsonResult(cr));
        }
예제 #11
0
        public JsonResult AddDesignation([FromBody] EmpDesignation designation)
        {
            CommonResponse cr = new CommonResponse();

            try
            {
                var isExist = DataAccess.Instance.CommonServices.IsExist("Emp_Designation", "DesignationName = '" + designation.DesignationName + "' ");
                if (isExist)
                {
                    throw new Exception("Designation Already Exist.");
                }
                designation.AddDate = DateTime.Now;
                designation.AddBy   = User.Identity.Name;
                designation.SetDate();
                _context.EmpDesignation.Add(designation);
                _context.SaveChanges();
            }
            catch (Exception ex)
            {
                cr.message = ex.Message;
                cr.results = Constant.FAILED;
            }
            return(new JsonResult(cr));
        }
        private CommonResponse SaleStop(ProductModel product)
        {
            Wave.Interface.Elevenia.ServiceInterface sInterface = new Interface.Elevenia.ServiceInterface();

            CommonResponse res = new CommonResponse();

            try
            {
                res = sInterface.ProductSaleStopModify(product.ProductMapping.IntelockProductNo);

                if (res.ResultCd == CommonResponse.ReturnType.Success)
                {
                    res = setProductMapping(product.ProductNo, (int)InterlockId.Elevenia, StatusCd.STOPSALE.ToString());
                }
            }
            catch (Exception ex)
            {
                res.ResultCd  = Common.CommonResponse.ReturnType.Error;
                res.ResultMsg = ex.ToString();
            }


            return(res);
        }
        private CommonResponse setProductMapping(int productNo, int interlockId, decimal salePrice)
        {
            CommonResponse res = new CommonResponse();

            try
            {
                using (DataContext db = new DataContext())
                {
                    var updateMapping = db.ProductMappings.Where(p => p.ProductNo == productNo && p.InterlockId == interlockId).FirstOrDefault();
                    if (updateMapping != null)
                    {
                        updateMapping.SalePrice = salePrice;
                        db.SaveChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                res.ResultCd  = Common.CommonResponse.ReturnType.Error;
                res.ResultMsg = "Error :setProductMapping() [86] : " + ex.ToString();
            }

            return(res);
        }
        public JsonResult AddProject(Project project)
        {
            CommonResponse cr = new CommonResponse();

            try
            {
                var a = DataAccess.Instance.CommonServices.IsExist("Task_Project", "ProjectName = '" + project.ProjectName + "' ");
                if (a)
                {
                    throw new Exception("Project Already Exist.");
                }
                project.AddDate = DateTime.Now;
                project.AddBy   = User.Identity.Name;
                project.SetDate();
                _context.Project.Add(project);
                _context.SaveChanges();
            }
            catch (Exception ex)
            {
                cr.message = ex.Message;
                cr.results = Constant.FAILED;
            }
            return(new JsonResult(cr));
        }
예제 #15
0
        /// <summary>
        /// Get Child Part No
        /// </summary>
        /// <param name="partNo"></param>
        /// <returns></returns>
        public CommonResponse GetChildPartNo(string partNo)
        {
            CommonResponse obj = new CommonResponse();

            try
            {
                var check = (from wf in db.UnitworkccsTblchildfgpartno
                             where wf.FgPartNo == partNo && wf.IsDeleted == 0
                             select new
                {
                    childFgPartNo = wf.ChildFgPartNo,
                    childPartNoDesc = wf.ChildPartNoDesc
                }).ToList();

                if (check.Count > 0)
                {
                    obj.isStatus = true;
                    obj.response = check;
                }
                else
                {
                    obj.isStatus = false;
                    obj.response = ResourceResponse.FailureMessage;
                }
            }
            catch (Exception e)
            {
                log.Error(e); if (e.InnerException != null)
                {
                    log.Error(e.InnerException.ToString());
                }
                obj.isStatus = false;
                obj.response = ResourceResponse.FailureMessage;
            }
            return(obj);
        }
예제 #16
0
        /// <summary>
        /// Delete operator
        /// </summary>
        /// <param name="Delete Operator"></param>
        /// <returns></returns>
        public CommonResponse DeleteOperatorShift(int Id)
        {
            CommonResponse obj = new CommonResponse();

            try
            {
                var check = db.UnitworkccsTblemployeeshiftdetails.Where(m => m.Id == Id).FirstOrDefault();
                if (check != null)
                {
                    check.IsDeleted  = 1;
                    check.ModifiedOn = DateTime.Now;
                    check.ModifiedBy = 3;
                    db.SaveChanges();
                    obj.isStatus = true;
                    obj.response = ResourceResponse.DeletedSuccessMessage;
                }
            }
            catch (Exception e)
            {
                obj.isStatus = false;
                obj.response = ResourceResponse.FailureMessage;
            }
            return(obj);
        }
        public IActionResult SaveCalendarData(AppointmentViewModel data)
        {
            CommonResponse <int> commonResponse = new CommonResponse <int>();

            try
            {
                commonResponse.status = _appointmentService.AddUpdate(data).Result;
                if (commonResponse.status == 1)
                {
                    commonResponse.message = Helper.appointmentUpdated;
                }
                if (commonResponse.status == 2)
                {
                    commonResponse.message = Helper.appointmentAdded;
                }
            }
            catch (Exception e)
            {
                commonResponse.message = e.Message;
                commonResponse.status  = Helper.failure_code;
            }

            return(Ok(commonResponse));
        }
예제 #18
0
        public void BasicRoaTokenConnection()
        {
            if (base.GetRoleArn().Equals("FakeRoleArn"))
            {
                return;
            }

            BasicSessionCredentials basciCredential = new BasicSessionCredentials(this.GetBasicAccessKeyId(), this.GetBasicAccessKeySecret(), this.GetToken());
            DefaultProfile          profile         = DefaultProfile.GetProfile(this.regionId, this.GetBasicAccessKeyId(), this.GetBasicAccessKeySecret());
            DefaultAcsClient        client          = new DefaultAcsClient(profile, basciCredential);

            CommonRequest request = new CommonRequest();

            request.Domain     = "ros.aliyuncs.com";
            request.Version    = "2015-09-01";
            request.Action     = "DescribeResourceTypes";
            request.UriPattern = "/resource_types";
            request.Method     = MethodType.GET;

            CommonResponse response = client.GetCommonResponse(request);

            Assert.Equal(200, response.HttpStatus);
            Assert.NotNull(response.Data);
        }
예제 #19
0
        public CommonResponse AutoAnalysis(string period, string state, string name)
        {
            if (WebOperationContext.Current.IncomingRequest.Headers == null)
            {
                throw new Exception("Can not get current WebOpreationContext.");
            }

            var viewLogic = new ViewLogic();
            var result    = new CommonResponse();

            try
            {
                result.code = "200";
                var stock_list = name == null ? new List <string>() : name.Split(',').ToList();
                result.message = viewLogic.AutoAnalysis(period == null ? string.Empty : period.ToLower(), "avg", stock_list);
            }
            catch (Exception ex)
            {
                result.code = "400";
                Console.WriteLine(ex.ToString());
            }

            return(result);
        }
예제 #20
0
        public ActionResult Add(ProductModel productModel)
        {
            //productservisten categorylistesini al
            if (!ModelState.IsValid)
            {
                return(View());
            }

            if (Request.Files.Count > 0)
            {
                //resim var
                string path = Server.MapPath("/");

                if (!Directory.Exists(path + "/ProductImage"))
                {
                    Directory.CreateDirectory(path + "/ProductImage");
                }

                for (int i = 0; i < Request.Files.Count; i++)
                {
                    string imagePath = path + "/ProductImage/" + Request.Files[i].FileName;
                    Request.Files[i].SaveAs(imagePath);
                    productModel.ProductImages.Add("/ProductImage/" + Request.Files[i].FileName);
                }
            }

            CommonResponse categoryChangeResponse = WebApiOperation.SendPost <ProductModel, CommonResponse>(Constants.PRODUCT_API_BASE_URI, Constants.PRODUCT_API_ADD, productModel);

            if (categoryChangeResponse.Code != 0)
            {
                ViewBag.error = categoryChangeResponse.Message;
                return(View());
            }
            ViewBag.error = MyResource.Resource.General_Success;
            return(View());
        }
예제 #21
0
        /// <summary>
        /// 发送短信
        /// </summary>
        /// <param name="PhoneNumbers">手机号 (多个用逗号隔开)</param>
        /// <param name="Code">短信模板code(枚举 SMSType) SMS_189761938</param>
        /// <param name="value">模板内容参数(json格式 {"code":"value"})</param>
        /// <returns>返回200 及发送成功</returns>
        public static int SendSms(string PhoneNumbers, int Code, int value)
        {
            //通过枚举获得发送的模板类型
            string TemplateCode = Enum.GetName(typeof(SMSType), Code);
            //生成随机数



            IClientProfile   profile = DefaultProfile.GetProfile("cn-hangzhou", appId, appPwd);
            DefaultAcsClient client  = new DefaultAcsClient(profile);
            CommonRequest    request = new CommonRequest
            {
                Method  = MethodType.POST,
                Domain  = "dysmsapi.aliyuncs.com",
                Version = "2017-05-25",
                Action  = "SendSms"
            };

            // request.Protocol = ProtocolType.HTTP;
            request.AddQueryParameters("PhoneNumbers", PhoneNumbers);
            request.AddQueryParameters("SignName", "十月微凉");
            request.AddQueryParameters("TemplateCode", TemplateCode);
            request.AddQueryParameters("TemplateParam", "{\"code\":\"" + value + "\"}");
            try
            {
                CommonResponse response = client.GetCommonResponse(request);

                //LoggerHelper.Info("SMS|  " + PhoneNumbers + "【" + Params + "】");HttpStatus
                return(response.HttpStatus);
                //return System.Text.Encoding.Default.GetString(response.HttpResponse.Content);
            }
            catch
            {
                throw;
            }
        }
예제 #22
0
        /// <summary>
        /// View Rework Details
        /// </summary>
        /// <param name="machineId"></param>
        /// <param name="fgPartId"></param>
        /// <returns></returns>
        public CommonResponse ViewReworkDetails(int machineId, int fgPartId)
        {
            CommonResponse obj = new CommonResponse();

            try
            {
                var check = (from wf in db.UnitworkccsTblreworkdetails
                             where wf.MachineId == machineId && wf.FgPartId == fgPartId
                             select new
                {
                    ReworkId = wf.ReworkId,
                    DefectCodeId = wf.DefectCodeId,
                    DefectQty = wf.DefectQty,
                    DefectCode = db.UnitworkccsTbldefectcodemaster.Where(m => m.DefectCodeId == wf.DefectCodeId).Select(m => m.DefectCodeName).FirstOrDefault() + " - " + db.UnitworkccsTbldefectcodemaster.Where(m => m.DefectCodeId == wf.DefectCodeId).Select(m => m.DefectCodeDesc).FirstOrDefault(),
                    QrCodeNo = wf.QrCodeNo,
                    reasonForRework = wf.ReasonForRework
                }).ToList();

                if (check.Count > 0)
                {
                    obj.isStatus = true;
                    obj.response = check;
                }
                else
                {
                    obj.isStatus = false;
                    obj.response = "No Items Found";
                }
            }
            catch (Exception ex)
            {
                obj.isStatus = false;
                obj.response = ResourceResponse.FailureMessage;
            }
            return(obj);
        }
예제 #23
0
파일: Tools.cs 프로젝트: xianyz/SchoolBus
        /// <summary>
        /// 发短信
        /// </summary>
        /// <param name="phoneNumber">手机号</param>
        /// <param name="msg">内容</param>
        public static AliSmsModel SendSms(string phoneNumber, string msg)
        {
            IClientProfile   profile = DefaultProfile.GetProfile(_settings.AliOption.RegionId, _settings.AliOption.AccessKeyId, _settings.AliOption.AccessKeySecret);
            DefaultAcsClient client  = new DefaultAcsClient(profile);
            CommonRequest    request = new CommonRequest
            {
                Method  = MethodType.POST,
                Domain  = _settings.AliOption.Domain,
                Version = _settings.AliOption.Version,
                Action  = _settings.AliOption.Action
                          //,Protocol = ProtocolType.HTTP
            };

            request.AddQueryParameters("PhoneNumbers", phoneNumber);
            request.AddQueryParameters("SignName", _settings.AliOption.SignName);
            request.AddQueryParameters("TemplateCode", _settings.AliOption.TemplateCode);
            request.AddQueryParameters("TemplateParam", "{\"code\":\"" + msg + "\"}");
            request.AddQueryParameters("OutId", _settings.AliOption.OutId);
            try
            {
                CommonResponse response = client.GetCommonResponse(request);
                return(JsonConvert.DeserializeObject <AliSmsModel>(Encoding.Default.GetString(response.HttpResponse.Content)));
            }
            catch (ServerException)
            {
                return(new AliSmsModel {
                    Code = "scfaile", Message = "发短信服务器异常,请稍后重试"
                });
            }
            catch (ClientException)
            {
                return(new AliSmsModel {
                    Code = "scfaile", Message = "发短信客户端异常,请稍后重试"
                });
            }
        }
예제 #24
0
        public async Task <CommonResponse> CheckProposalGenerated([FromBody] QuoteGetReq request)
        {
            var response = new CommonResponse();

            try
            {
                if (request != null && !string.IsNullOrEmpty(request.QRFID))
                {
                    response = await _agentApprovalRepository.CheckProposalGenerated(request);
                }
                else
                {
                    response.ResponseStatus.Status       = "Failure";
                    response.ResponseStatus.ErrorMessage = "QRF ID can not be Null/Blank.";
                }
            }
            catch (Exception ex)
            {
                response.ResponseStatus.Status       = "Failure";
                response.ResponseStatus.ErrorMessage = "An Error Occurs :- " + ex.Message;
            }

            return(response);
        }
예제 #25
0
        /// <summary>
        /// 用户注册
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="password"></param>
        /// <param name="code"></param>
        /// <param name="sale"></param>
        /// <returns></returns>
        public string Register(string userName, string password, string code, string sale, out string message)
        {
            string resultToken = "";

            message = "";
            try
            {
                string apiName           = "user";
                UserRegisterRequest user = new UserRegisterRequest()
                {
                    username = userName, password = password, code = code
                };
                if (!string.IsNullOrEmpty(sale))
                {
                    user.sale = sale;
                }
                string         json           = JsonConvert.SerializeObject(user);
                string         resultStr      = HttpHelper.HttpUrlSend(apiName, "POST", json);
                CommonResponse resultResponse = JsonConvert.DeserializeObject <CommonResponse>(resultStr);
                if (resultResponse.state)
                {
                    UserRegisterResponse resultInfo = JsonConvert.DeserializeObject <UserRegisterResponse>(resultResponse.result);
                    resultToken = resultInfo.sessionToken;
                }
                else
                {
                    message = resultResponse.message;
                }
            }
            catch (Exception ex)
            {
                message = "注册用户失败";
                WPFClientCheckWordUtil.Log.TextLog.SaveError(ex.Message);
            }
            return(resultToken);
        }
예제 #26
0
 public void TS_Smsa(Auth auth, Smsa request, Smsa_Logic logic, CommonResponse ecr, string[] token, string uri)
 {
     if (auth.AuthResult(token, uri))
     {
         if (uri.IndexOf("/smsa1/count") > 0)
         {
             ecr.data.results = logic.GetCount(request);
         }
         else if (uri.IndexOf("/smsa1/sps") > 0)
         {
             ecr.data.results = logic.GetSpsList(request);
         }
         else if (uri.IndexOf("/smsa2/create") > 0)
         {
             ecr.data.results = logic.Insert_Smsa2(request);
         }
         else if (uri.IndexOf("/smsa2/update") > 0)
         {
             ecr.data.results = logic.Update_Smsa2(request);
         }
         else if (uri.IndexOf("/smsa2/read") > 0)
         {
             ecr.data.results = logic.Read_Smsa2(request);
         }
         else if (uri.IndexOf("/smsa2/delete") > 0)
         {
         }
         ecr.meta.code    = 200;
         ecr.meta.message = "OK";
     }
     else
     {
         ecr.meta.code    = 401;
         ecr.meta.message = "Unauthorized";
     }
 }
        /// <summary>
        /// Upload Child Fg Part No
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public CommonResponse UploadChildFgPartNo(List <UploadChildPartNo> data)
        {
            CommonResponse obj = new CommonResponse();

            try
            {
                var check = db.UnitworkccsTblchildfgpartno.Where(m => m.IsDeleted == 0).ToList();
                db.RemoveRange(check);
                db.SaveChanges();

                foreach (var item in data)
                {
                    UnitworkccsTblchildfgpartno UnitworkccsTblchildfgpartno = new UnitworkccsTblchildfgpartno();
                    UnitworkccsTblchildfgpartno.ChildFgPartNo   = item.childFgPartNo;
                    UnitworkccsTblchildfgpartno.ChildPartNoDesc = item.childPartNoDesc;
                    UnitworkccsTblchildfgpartno.FgPartNo        = item.fgPartNo;
                    UnitworkccsTblchildfgpartno.FgPartDesc      = item.fgPartDesc;
                    UnitworkccsTblchildfgpartno.IsDeleted       = 0;
                    UnitworkccsTblchildfgpartno.CreatedOn       = DateTime.Now;
                    db.UnitworkccsTblchildfgpartno.Add(UnitworkccsTblchildfgpartno);
                    db.SaveChanges();
                    obj.isStatus = true;
                    obj.response = ResourceResponse.AddedSuccessMessage;
                }
            }
            catch (Exception e)
            {
                log.Error(e); if (e.InnerException != null)
                {
                    log.Error(e.InnerException.ToString());
                }
                obj.isStatus = false;
                obj.response = ResourceResponse.FailureMessage;
            }
            return(obj);
        }
예제 #28
0
        public CommonResponse DeactiveUser(int userId)
        {
            CommonResponse commonResponseModel = new CommonResponse();

            try
            {
                commonResponseModel.IsSuccess = this.unitOfWork.UserRepository.DeactiveUser(userId);
                if (commonResponseModel.IsSuccess == true)
                {
                    commonResponseModel.StatusMessage = Messages.DeactiveUserMessage;
                }
                else
                {
                    commonResponseModel.StatusMessage = Messages.DeactiveUserFailed;
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.StackTrace.ToString());
                commonResponseModel.IsSuccess     = false;
                commonResponseModel.StatusMessage = Messages.UserAlreadyError;
            }
            return(commonResponseModel);
        }
예제 #29
0
        public IActionResult Approve([FromBody] VoucherIssuance_VM voucherIssuance_VM)
        {
            CommonResponse <int> response = new CommonResponse <int>();

            if (voucherIssuance_VM != null)
            {
                var result = _voucherIssuanceRepository.SetApproveStatus(voucherIssuance_VM, loginUserId);
                if (result == 0)
                {
                    response.status  = Helper.failure_code;
                    response.message = "Voucher status change un-successfully";
                }
                else
                {
                    response.status  = Helper.success_code;
                    response.message = voucherIssuance_VM.IsApproved.Value ? "Voucher approved successfully" : "Voucher rejected successfully";
                }
            }
            else
            {
                response.message = Message.badRequest;
            }
            return(Ok(response));
        }
예제 #30
0
        /// <summary>
        /// View Vendor Details
        /// </summary>
        /// <returns></returns>
        public CommonResponse ViewVendorDetails()
        {
            CommonResponse obj = new CommonResponse();

            try
            {
                var check = (from wf in db.UnitworkccsTblvendor
                             where wf.IsDeleted == 0
                             select new
                {
                    vendor = wf.Vendor,
                    vendorId = wf.VendorId,
                    vendorName = wf.VendorName
                }).ToList();
                if (check.Count > 0)
                {
                    obj.isStatus = true;
                    obj.response = check;
                }
                else
                {
                    obj.isStatus = false;
                    obj.response = ResourceResponse.NoItemsFound;
                }
            }
            catch (Exception e)
            {
                log.Error(e); if (e.InnerException != null)
                {
                    log.Error(e.InnerException.ToString());
                }
                obj.isStatus = false;
                obj.response = ResourceResponse.FailureMessage;
            }
            return(obj);
        }
예제 #31
0
        public IActionResult GetAll()
        {
            CommonResponse <PluginCollection> model = new CommonResponse <PluginCollection>();

            try
            {
                model.Result = new PluginCollection
                {
                    Plugins = _pluginService.GetPluginDescriptors <IPlugin>().Select(s => new Plugin
                    {
                        Description = s.Description,
                        Name        = s.SystemName,
                        Installed   = s.Installed
                    }),
                    NeedToRestart = _pluginService.NeedToRestart
                };
            }
            catch (Exception)
            {
                model.IsError = true;
                model.Message = "Occur an error, please try later!";
            }
            return(Ok(model));
        }
예제 #32
0
        public CommonResponse UpdateEmail(UserModel userModel)
        {
            CommonResponse commonResponse = new CommonResponse();

            try
            {
                UserInfo userinfo = this.Find(d => d.UserId == userModel.UserId);
                userinfo.OldEmail   = userinfo.EmailId;
                userinfo.EmailId    = userModel.EmailId;
                userinfo.Modifiedon = DateTime.UtcNow;
                this.Update(userinfo);
                commonResponse.IsSuccess = true;
                var userinfoDetails = userinfo.ConvertUser();
                commonResponse.userInfo = userinfoDetails;
            }
            catch (Exception ex)
            {
                logger.Error("Respository" + ex.Message);
                this.LogError(ex);
                throw ex;
            }

            return(commonResponse);
        }
        /// <summary>
        /// DeleteToolFromSocket
        /// </summary>
        /// <param name="socketNumber"></param>
        /// <param name="machineId"></param>
        /// <returns></returns>
        public CommonResponse DeleteToolFromSocket(string socketNumber, int machineId)
        {
            CommonResponse obj = new CommonResponse();

            try
            {
                var check = (from m in db.UnitworkccsTbltoolandsocketdetails
                             where m.MachineId == machineId && m.SocketNo == socketNumber && m.IsDeleted == 0
                             select m).FirstOrDefault();
                if (check != null)
                {
                    check.IsDeleted           = 1;
                    check.ToolRemovedDateTime = DateTime.Now;
                    check.ModifiedBy          = 1;
                    check.ModifiedOn          = DateTime.Now;
                    db.SaveChanges();
                    obj.isStatus = true;
                    obj.response = Resource.ResourceResponse.DeletedSuccessMessage;
                }
                else
                {
                    obj.isStatus = false;
                    obj.response = Resource.ResourceResponse.NoItemsFound;
                }
            }
            catch (Exception e)
            {
                log.Error(e); if (e.InnerException != null)
                {
                    log.Error(e.InnerException.ToString());
                }
                obj.isStatus = false;
                obj.response = ResourceResponse.FailureMessage;
            }
            return(obj);
        }
        /// <summary>
        /// Delete Document
        /// </summary>
        /// <param name="checkListLOTOTOId"></param>
        /// <param name="userId"></param>
        /// <returns></returns>
        public CommonResponse DeleteCheckListLOTOTO(int checkListLOTOTOId, long userId = 0)
        {
            CommonResponse obj            = new CommonResponse();
            CommonFunction commonFunction = new CommonFunction();

            try
            {
                var res = db.CheckListLototomaster.Where(m => m.LototoCheckListId == checkListLOTOTOId).FirstOrDefault();
                if (res != null)
                {
                    res.IsDeleted  = true;
                    res.ModifiedOn = DateTime.Now;
                    db.SaveChanges();

                    commonFunction.ChangeCheckListAndJobStepNumberOfPreviousItem(res.CheckListMasterId, res.CheckListGroupId, "LOTOTO", "CheckList");

                    obj.response = ResourceResponse.DeletedSucessfully;
                    obj.isStatus = true;
                }
                else
                {
                    obj.response = ResourceResponse.FailureMessage;
                    obj.isStatus = false;
                }
            }
            catch (Exception ex)
            {
                log.Error(ex); if (ex.InnerException != null)
                {
                    log.Error(ex.InnerException.ToString());
                }
                obj.response = ResourceResponse.ExceptionMessage;
                obj.isStatus = false;
            }
            return(obj);
        }
예제 #35
0
 private void Delete_Callback(CommonResponse response)
 {
     dgvList.RemoveRow(dgvList.CurrentRow);
     SOAFramework.Client.Controls.MessageBox.Show(this, "删除成功");
 }
예제 #36
0
 private void DeleteBuilding_Callback(CommonResponse response)
 {
     tvBuilding.TopNode.Nodes.Remove(_selectedNode);
     var building = _selectedNode.Tag as FullBuilding;
     _buildings.Remove(building);
     _selectedNode = null;
 }
예제 #37
0
        /// <summary>
        /// Verify requirements related to the responding of all request type.
        /// </summary>
        /// <param name="response">The HTTP response returned from server.</param>
        /// <param name="commonResponse">The response format parsed by TestSuite.</param>
        /// <param name="responseCode">The value of X-ResponseCode.</param>
        private void VerifyRespondingToAllRequestTypeRequests(HttpWebResponse response, CommonResponse commonResponse, uint responseCode)
        {
            List<string> headerValus = response.Headers.AllKeys.ToList<string>();

            if (!string.IsNullOrEmpty(response.Headers["X-ResponseCode"]) && responseCode == 0)
            {
                // If the response includes the Transfer-Encoding header, then the response is a chunked response.
                if (!string.IsNullOrEmpty(response.Headers["Transfer-Encoding"]))
                {
                    // Add the debug information
                    this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1229");

                    // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1229
                    // If the response is not null, that means the server can return response to corresponding request type requests. 
                    this.Site.CaptureRequirementIfIsNotNull(
                        response,
                        1229,
                        @"[In Responding to All Request Type Requests] The server can respond to all request type requests with a chunked response, as specified in section 2.2.2.2.");

                    // Add the debug information
                    this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1232");

                    // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1232
                    // If the code can reach here, Transfer-Encoding header is exist. 
                    // If Content-Length header is null, that means the Transfer-Encoding header is used instead of the Content-Length header field.
                    this.Site.CaptureRequirementIfIsNull(
                        response.Headers["Content-Length"],
                        1232,
                        @"[In Responding to All Request Type Requests] The Transfer-Encoding header is used instead of the Content-Length header field as specified in section 2.2.3.2.1.");

                    // Add the debug information
                    this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1238");

                    // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1238
                    this.Site.CaptureRequirementIfAreEqual<string>(
                        "PROCESSING",
                        commonResponse.MetaTags[0],
                        1238,
                        @"[In Responding to All Request Type Requests] The initial response includes the PROCESSING meta-tag, as specified in section 2.2.7.");

                    // The structure of response body is parsed according to the request of this Specification, if the code run to here and passed, 
                    // that means R41 is invoked successfully.
                    this.Site.CaptureRequirement(
                        41,
                        @"[In Common Response Format] The common server response across all endpoints (4) used in this protocol has the following formats, depending on whether the response is chunked.
Chunked response:
 HTTP/1.1 200 OK
 Transfer-Encoding: chunked
 Content-Type: application/mapi-http
 X-RequestType: <?>
 X-ResponseCode: <?>
 X-RequestId: <?>
 X-ServerApplication:<server version>
 
 <META-TAGS>
 <ADDITIONAL HEADERS>
 <RESPONSE BODY>");

                    // Add the debug information
                    this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1300");

                    // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1300
                    this.Site.CaptureRequirementIfIsTrue(
                        headerValus.Contains("Transfer-Encoding"),
                        1300,
                        @"[In Common Response Format] In addition to headers [Host, Content-Type, X-RequestType and X-ResponseCode], a chunked response contains the Transfer-Encoding header, specified in section 2.2.3.2.5.");

                    // Add the debug information
                    this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R2231");

                    // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R2231
                    // The structure of response body is parsed according to the request of this Specification, if the code run to here and passed, 
                    // that means R2231 is invoked successfully.
                    this.Site.CaptureRequirement(
                        2231,
                        @"[In Responding to All Request Type Requests] The request type response body for the initiating request type will immediately follow any additional headers preceded by a CRLF on an empty line.");

                    // Add the debug information
                    this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R2228");

                    // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R2228
                    // The structure of response body is parsed according to the request of this Specification, if the code run to here and passed, 
                    // that means R2228 is invoked successfully.
                    this.Site.CaptureRequirement(
                        2228,
                        @"[In Responding to All Request Type Requests] The X-ElapsedTime and X-StartTime are present after the DONE meta-tag, as specified in section 2.2.3.3.9 and 2.2.3.3.10 respectively.");

                }

                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R42");

                // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R42
                this.Site.CaptureRequirementIfAreEqual<string>(
                    "POST",
                    response.Method,
                    42,
                    @"[In Common Response Format] The first line of all server responses begins with the POST method response specified in [RFC2616], ""HTTP/1.1"".");

                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R43");

                // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R43
                // If StatusCode is not null, that means server response contains an HTTP status code.
                this.Site.CaptureRequirementIfIsNotNull(
                    response.StatusCode,
                    43,
                    @"[In Common Response Format] It [The first line of all server responses] also contains an HTTP status code, as described in this section.");

                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R54");

                // Since all the succeed and failure situation is judged according to X-ResponseCode header, if the code executes to here, R54 is verified successfully.
                this.Site.CaptureRequirement(
                    54,
                    @"[In Common Response Format] This header [X-ResponseCode] contains a numerical value that indicates the specific failure that occurred on the server.");

                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1301");

                // If the code execute to here, that means the server returned an X-ResponseCode header for success condition.
                this.Site.CaptureRequirement(
                    1301,
                    @"[In Common Response Format] For success condition, the server will return an X-ResponseCode header.");
            }
            else if (!string.IsNullOrEmpty(response.Headers["X-ResponseCode"]) && responseCode != 0)
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1459");

                // If the code execute to here, that means the server returned an X-ResponseCode header for non-exceptional condition (most failures).
                this.Site.CaptureRequirement(
                    1459,
                    @"[In Common Response Format] For non-exceptional condition (most failures), the server will return an X-ResponseCode header.");

                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R2229");

                // If the code execute to here, that means the server returned an X-ResponseCode header if failure occurs.
                this.Site.CaptureRequirement(
                    2229,
                    @"[In Responding to All Request Type Requests] The server will include a X-ResponseCode header, as specified in section 2.2.3.3.3, if a failure occurs after the initial response is sent.");

                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R2229");

                // If the code execute to here, that means the server returned an X-ResponseCode header if failure occurs.
                this.Site.CaptureRequirement(
                    2229,
                    @"[In Responding to All Request Type Requests] The server will include a X-ResponseCode header, as specified in section 2.2.3.3.3, if a failure occurs after the initial response is sent.");

                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R2230");

                // If the code execute to here, that means the server returned an X-ResponseCode header and the value is not 0 when failure occurs.
                this.Site.CaptureRequirement(
                    2230,
                    @"[In Responding to All Request Type Requests] More specifically, this gives the server the ability to later fail the request and return a different value in the X-ResponseCode header.");
            }
        }
예제 #38
0
        /// <summary>
        /// Verify the PING request type related requirements.
        /// </summary>
        /// <param name="commonResponse">The CommonResponse to be verified.</param>
        /// <param name="endpoint">The value of server endpoint.</param>
        /// <param name="responseCode">The value of X-ResponseCode header.</param>
        private void VerifyPINGRequestType(CommonResponse commonResponse, ServerEndpoint endpoint, uint responseCode)
        {
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1460");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1460
            this.Site.CaptureRequirementIfAreEqual<int>(
                0,
                commonResponse.ResponseBodyRawData.Length,
                1460,
                @"[In PING Request Type] The PING request type has no response body.");

            if (responseCode == 0 && endpoint == ServerEndpoint.MailboxServerEndpoint)
            {
                // If the code can reach here, that means the Mailbox server endpoint executes successfully, R1127 is verified successfully.
                this.Site.CaptureRequirement(
                    1127,
                    @"[In PING Request Type] The PING request type is supported by the mailbox server endpoint (4).");
            }
            else if (responseCode == 0 && endpoint == ServerEndpoint.AddressBookServerEndpoint)
            {
                // If the code can reach here, that means the AddressBook server endpoint executes successfully, R1128 is verified successfully.
                this.Site.CaptureRequirement(
                    1128,
                    @"[In PING Request Type] The PING request type is supported by the address book server endpoint (4).");
            }

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1247");
        
            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1247
            // If the response is not null, that means the server responds to a PING request type.
            this.Site.CaptureRequirementIfIsNotNull(
                commonResponse,
                1247,
                @"[In Responding to a PING Request Type] The server responds to a PING request type by returning a PING request type response, as specified in section 2.2.6.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1249");
        
            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1249
            this.Site.CaptureRequirementIfIsTrue(
                commonResponse.MetaTags.Count != 0 && commonResponse.ResponseBodyRawData.Length == 0,
                1249,
                @"[In Responding to a PING Request Type] Meta-tags can be returned, but no response body is returned.");
        }
예제 #39
0
 private void Delete_Callback(CommonResponse response)
 {
     dgvList.RemoveRow<Customer>(dgvList.SelectedRows[0]);
     SOAFramework.Client.Controls.MessageBox.Show(this, "删除成功");
 }
예제 #40
0
 private void Save_Callback(CommonResponse response)
 {
     SOAFramework.Client.Controls.MessageBox.Show(this, "账单更新成功");
 }
예제 #41
0
 private void btnDelete_ClickCallback(CommonResponse response)
 {
     dgvUsers.RemoveRow<FullUser>(dgvUsers.CurrentRow);
     SOAFramework.Client.Controls.MessageBox.Show(this, "删除成功!", "信息");
 }
예제 #42
0
        public async Task <CommonResponse <string> > BorrowRegisterNotify(int dayLimit)
        {
            var response = new CommonResponse <string>();

            try
            {
                var list = await _db.BorrowRegister.Where(c => !c.Deleted && c.ReturnDate <= DateTime.Now.AddDays(dayLimit) && (!c.ReturnNotified.HasValue || c.ReturnNotified.Value == false) &&
                                                          (c.Status == BorrowRegisterStatus.Borrowed || c.Status == BorrowRegisterStatus.Overdue || c.Status == BorrowRegisterStatus.Renewed))
                           .OrderBy(c => c.Id).Take(50).ToListAsync();

                //var archivesList = await _db.ArchivesInfo.Join(_db.BorrowRegisterDetail, a => a.Id, b => b.ArchivesId, (a, b) => new { a, b })
                //    .Where(j => list.Select(l => l.Id).Contains(j.b.BorrowRegisterId))
                //    .Select(c => new
                //    {
                //        c.a.ProjectName,
                //        c.b.Id,
                //        c.b.BorrowRegisterId
                //    }).ToListAsync();

                var ids      = list.Select(c => c.Id);
                var projects = await _db.BorrowRegisterDetail.AsNoTracking().Where(c => ids.Contains(c.BorrowRegisterId)).Select(c => new { c.ProjectName, c.BorrowRegisterId }).ToListAsync();

                if (list.Any())
                {
                    list.ForEach(c =>
                    {
                        var project = projects.FirstOrDefault(a => a.BorrowRegisterId == c.Id);

                        ApplicationLog.Info("task.SMS_171116662." + c.Phone + "." + c.Id);
                        var msgRes = OssHelper.SendSms("SMS_171116662", c.Phone, $"{{\"name\":\"{c.Borrower}\", \"PtName\":\"{(project?.ProjectName)}\", \"RDate\":\"{c.ReturnDate.ToString("yyyy-MM-dd")}\" }}");
                        //循环发送短信
                        if (msgRes.Code == "OK")
                        {
                            c.ReturnNotified = true;
                            c.NotifyCount    = c.NotifyCount.GetValueOrDefault() + 1;
                            c.UpdateTime     = DateTime.Now;
                        }
                    });
                    var data = list.Select(c => c.Id).Serialize();
                    await _db.OperationLog.AddAsync(new OperationLog
                    {
                        Action     = OperationAction.Create,
                        Name       = "催还短信",
                        CreateTime = DateTime.Now,
                        BeforeData = data
                    });

                    await _db.SaveChangesAsync();

                    response.Data = data;
                }
                response.Success = true;
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
                ApplicationLog.Error("BorrowRegisterNotify", ex);
            }

            return(response);
        }
예제 #43
0
 private void Delete_Callback(CommonResponse reponse)
 {
     dgvBill.RemoveRow<DataRowView>(dgvBill.CurrentRow);
     SOAFramework.Client.Controls.MessageBox.Show(this, "删除账单成功!");
 }
예제 #44
0
        /// <summary>
        /// Verify the Request Types For Mailbox Server Endpoint related requirements.
        /// </summary>
        /// <param name="headers">The headers to be verified.</param>
        /// <param name="commonResponse">The CommonResponse to be verified.</param>
        private void VerifyRequestTypesForMailboxServerEndpoint(WebHeaderCollection headers, CommonResponse commonResponse)
        {
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R176, the value of X-RequestType header is {0}", headers["X-RequestType"]);

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R176
            this.Site.CaptureRequirementIfIsTrue(
                this.requestTypeList.Contains(headers["X-RequestType"]),
                176,
                @"[In Request Types for Mailbox Server Endpoint] The X-RequestType header, specified in section 2.2.3.3.1, identifies which request type is being used.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1431");
        
            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1431
            // This structure of response body is parsed according to the request of this Specification, if the response body exists, R1431 is verified successfully.
            this.Site.CaptureRequirementIfIsNotNull(
                commonResponse,
                1431,
                @"[In Request Types for Mailbox Server Endpoint] The response body associated with the specific request types are each a raw binary data binary large object (BLOB) that follows the common response format, as specified in section 2.2.2.2.");

            // This structure of common response is parsed according to the request of this Specification, if the code run to here and passed, 
            // that means R1461 is invoked successfully.
            this.Site.CaptureRequirement(
                1461,
                @"[In Request Types for Mailbox Server Endpoint] Response body is separated from the common response by a blank line, as specified in [RFC2616].");
        }
예제 #45
0
 private void Delete_Callback(CommonResponse response)
 {
     //var datasource = dgvHouse.DataSource as List<FullHouse>;
     //datasource.Remove(dgvHouse.SelectedRows[0].DataBoundItem as FullHouse);
     //dgvHouse.Reset();
     dgvHouse.RemoveRow<FullHouse>(dgvHouse.SelectedRows[0].DataBoundItem as FullHouse);
     SOAFramework.Client.Controls.MessageBox.Show(this, "删除成功");
 }
예제 #46
0
        /// <summary>
        /// 申报借阅
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <CommonResponse <BorrowRegisterResult> > BorrowRegister(BorrowRegisterRequest request)
        {
            var response = new CommonResponse <BorrowRegisterResult>();

            if (request == null)
            {
                response.Message = "参数不能为空";
                return(response);
            }
            if (string.IsNullOrEmpty(request.Phone))
            {
                response.Message = "手机不能为空";
                return(response);
            }
            if (string.IsNullOrEmpty(request.Borrower))
            {
                response.Message = "借阅人不能为空";
                return(response);
            }
            if (request.ReturnDate < DateTime.Now)
            {
                response.Message = "归还日期不能早于今天";
                return(response);
            }

            var regEntity = new dal.Entity.BorrowRegister
            {
                Borrower       = request.Borrower,
                Phone          = request.Phone,
                ReturnDate     = request.ReturnDate,
                SignPhoto      = request.SignPhoto,
                Status         = BorrowRegisterStatus.Registered,
                Company        = request.Company,
                Department     = request.Department,
                CreateTime     = DateTime.Now,
                Deleted        = false,
                UpdateTime     = DateTime.Now,
                ReturnNotified = false,
                Remark         = request.Remark
            };

            using (var trans = await _db.Database.BeginTransactionAsync())
            {
                try
                {
                    //var archives = await _db.ArchivesInfo.AsNoTracking().Where(c => request.ArchivesId.Contains(c.Id) && !c.Deleted).ToListAsync();
                    //if (archives.Count != request.ArchivesId.Count)
                    //{
                    //    throw new BizException("请求档案数目与数据库可用档案不一致,可能是数据已删除,请重新查询后再提交");
                    //}

                    //var borrowedArchives = archives.Where(c => c.Status == ArchivesStatus.Borrowed);
                    //if (borrowedArchives.Any())
                    //{
                    //    throw new BizException($"请求档案:{string.Join(",", borrowedArchives.Select(c => c.ArchivesNumber))} 当前状态为已借阅");
                    //}

                    await _db.BorrowRegister.AddAsync(regEntity);

                    await _db.SaveChangesAsync();

                    response.Data = new BorrowRegisterResult {
                        BorrowRegisterId = regEntity.Id
                    };

                    await _db.BorrowRegisterDetail.AddRangeAsync(request.Details.Select(c => new dal.Entity.BorrowRegisterDetail
                    {
                        ArchivesId       = 0,
                        BorrowRegisterId = regEntity.Id,
                        CreateTime       = DateTime.Now,
                        ArchivesNumber   = c.ArchivesNumber,
                        CategoryId1      = c.CategoryId1,
                        CategoryName1    = c.CategoryName1,
                        CategoryId2      = c.CategoryId2,
                        CategoryName2    = c.CategoryName2,
                        CategoryId3      = c.CategoryId3,
                        CategoryName3    = c.CategoryName3,
                        FileNumber       = c.FileNumber,
                        CategoryNumber   = c.CategoryId,
                        OrderNumber      = c.OrderNumber,
                        ProjectId        = c.ProjectId,
                        ProjectName      = c.ProjectName,
                        Title            = c.Title
                    }));

                    await _db.SaveChangesAsync();

                    trans.Commit();
                    response.Success = true;
                }
                catch (BizException ex)
                {
                    trans.Rollback();
                    response.Message = ex.Message;
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    response.Message = "提交申请借阅发生异常";
                    ApplicationLog.Error("BorrowRegister", ex);
                }
            }

            return(response);
        }
예제 #47
0
 private void CommonEvent(CommonResponse response)
 {
     if (response != null)
     {
         EntStaffTab item = this.dataService.GetStaffChatTab((long)((ulong)Jid.GetUid(response.from_jid))) as EntStaffTab;
         if (item == null)
         {
             IDKin.IM.Core.Staff staff = this.dataService.GetStaff((long)((ulong)Jid.GetUid(response.from_jid)));
             if (staff != null)
             {
                 item = new EntStaffTab(staff);
                 item.SetDefaultStyle();
                 ((INWindow)this.dataService.INWindow).ContentTab.Items.Add(item);
                 this.dataService.AddStaffChatTab(staff.Uid, item);
             }
         }
         if (item != null)
         {
             this.ActiveInWindow();
             this.PickUpMessageProcessor();
             MessageBoxWindow mbw = this.dataModel.GetMessageBox();
             if (mbw != null)
             {
                 mbw.Refresh();
             }
             this.FlashIconPorcessor();
             IDKin.IM.Core.Staff staff = this.dataService.GetStaff((long)((ulong)Jid.GetUid(response.from_jid)));
             if (staff != null)
             {
                 item.TabContent.ChatComponent.AddMessageNotice(staff.Name + "给你发送了一个震动!");
                 this.SelectedTab(item);
                 item.TabContent.ChatComponent.Vibration(true);
             }
         }
     }
 }