public GetObservedDataRequest(CustomerCode customer, SensorTimestamp start, SensorTimestamp?end = null, TimeUnitId?timeUnit = null) { Customer = customer; StartTimestamp = start; EndTimestamp = end; TimeUnitId = timeUnit; }
//Compara todas as propriedades da consulta private bool Equals(MedicalAppointment other) { return(Date == other.Date && MedicalAppointmentType == other.MedicalAppointmentType && CustomerCode.Equals(other.CustomerCode) && DoctorCode.Equals(other.DoctorCode) && Customer.Equals(other.Customer) && Doctor.Equals(other.Doctor)); }
//Cria hashcode para consulta public override int GetHashCode() { var hashCode = 825685457; hashCode = hashCode * -1521134295 + Date.GetHashCode(); hashCode = hashCode * -1521134295 + MedicalAppointmentType.GetHashCode(); hashCode = hashCode * -1521134295 + CustomerCode.GetHashCode(); hashCode = hashCode * -1521134295 + DoctorCode.GetHashCode(); return(hashCode); }
public async Task <ObservedDataResponse> GetCustomerAppliances(CustomerCode code, TimeInterval ti, ushort intervalOffset) { if (!Enum.IsDefined(typeof(TimeInterval), ti)) { throw new ArgumentException($"{nameof(TimeInterval)}: {ti} is not defined."); } Dictionary <TimeInterval, (int dayOffset, TimeUnit timeUnit)> test = new Dictionary <TimeInterval, (int, TimeUnit)> { { TimeInterval.Year, (-(int)TimeInterval.Year, TimeUnit.Day) },
public void MapperInit(IMapperConfigurationExpression config) { config.CreateMap <Customer, CustomerResponseModel>() .ForMember(e => e.Code, e => e.MapFrom(l => l.Code.ToString())); config.CreateMap <CustomerResponseModel, Customer>() .ForMember(e => e.Code, e => e.MapFrom(l => CustomerCode.FromString(l.Code))); config.CreateMap <Customer, CustomerRequestModel>() .ForMember(e => e.Code, e => e.MapFrom(l => l.Code.ToString())); config.CreateMap <CustomerRequestModel, Customer>() .ForMember(e => e.Code, e => e.MapFrom(l => CustomerCode.FromString(l.Code))); }
protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); builder.Entity <Customer>() .Property(b => b.Code) .HasConversion( v => v.ToString(), v => CustomerCode.FromString(v)); builder .Entity <Order>() .Property(e => e.Status) .HasConversion(new EnumToStringConverter <OrderStatus>()); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (CustomerId != null) { hashCode = hashCode * 59 + CustomerId.GetHashCode(); } if (CustomerCode != null) { hashCode = hashCode * 59 + CustomerCode.GetHashCode(); } if (CustomerName != null) { hashCode = hashCode * 59 + CustomerName.GetHashCode(); } if (Email != null) { hashCode = hashCode * 59 + Email.GetHashCode(); } if (CompanyName != null) { hashCode = hashCode * 59 + CompanyName.GetHashCode(); } if (CustomerGroupId != null) { hashCode = hashCode * 59 + CustomerGroupId.GetHashCode(); } hashCode = hashCode * 59 + DebitMoney.GetHashCode(); if (Address != null) { hashCode = hashCode * 59 + Address.GetHashCode(); } if (PhoneNumber != null) { hashCode = hashCode * 59 + PhoneNumber.GetHashCode(); } if (DateOfBirth != null) { hashCode = hashCode * 59 + DateOfBirth.GetHashCode(); } return(hashCode); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (CustomerCode != null) { hashCode = hashCode * 59 + CustomerCode.GetHashCode(); } if (Units != null) { hashCode = hashCode * 59 + Units.GetHashCode(); } return(hashCode); } }
public object C_Details(int page, int rows, string QueryString, string Value) { string CustomerCode = ""; string CustomerName = ""; if (QueryString == "CustomerCode") { CustomerCode = Value; } else { CustomerName = Value; } IQueryable <Customer> customerQuery = CustomerRepository.GetQueryable(); var customer = customerQuery.Where(c => c.CustomerCode.Contains(CustomerCode) && c.CustomerName.Contains(CustomerName)) .OrderBy(c => c.CompanyCode) .Select(c => c); if (!CustomerCode.Equals(string.Empty)) { customer = customer.Where(p => p.CustomerCode == CustomerCode); } int total = customer.Count(); customer = customer.Skip((page - 1) * rows).Take(rows); var temp = customer.ToArray().Select(c => new { CustomerCode = c.CustomerCode, CustomCode = c.CustomCode, CustomerName = c.CustomerName, CompanyCode = c.CompanyCode, IsActive = c.IsActive == "1" ? "可用" : "不可用" }); return(new { total, rows = temp.ToArray() }); }
/// <summary> /// Returns true if StructureProvision instances are equal /// </summary> /// <param name="other">Instance of StructureProvision to be compared</param> /// <returns>Boolean</returns> public bool Equals(StructureProvision other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( CustomerCode == other.CustomerCode || CustomerCode != null && CustomerCode.Equals(other.CustomerCode) ) && ( Units == other.Units || Units != null && other.Units != null && Units.SequenceEqual(other.Units) )); }
public CustomerNotExistsException(CustomerCode customerCode) { this.CustomerCode = customerCode; }
public Task <IEnumerable <ApplianceDto> > GetCustomerAppliances(CustomerCode code) => Task.FromResult((IEnumerable <ApplianceDto>) new List <ApplianceDto>() { new ApplianceDto() });
public Task <(Appliance appliance, ApplianceType type)?> GetCustomerAppliance(CustomerCode code, int applianceId) { return(Task.FromResult(((Appliance, ApplianceType)?)(new Appliance(123, new List <short?>(), new List <long>()), new ApplianceType(10, Enumerable.Empty <Appliance>())))); }
public CMCResponse UploadExcelFile() { try { //保存文件 var file = System.Web.HttpContext.Current.Request.Files[0]; string fullPath = HttpContext.Current.Server.MapPath("~/ExcelUpload/") + file.FileName; file.SaveAs(fullPath); //获取文件数据 using (FileStream fs = new FileStream(fullPath, FileMode.Open)) { IWorkbook workbook = new XSSFWorkbook(fs); ISheet sheet = workbook.GetSheetAt(0); int lastRowIndex = sheet.LastRowNum; //第一行获取活动名称 IRow row = sheet.GetRow(0); int rowLastIndex = row.LastCellNum - 1; string activeName = row.GetCell(rowLastIndex).StringCellValue; int lastColumn = 0; switch (activeName) { case "激活": lastColumn = 9; break; case "营销": lastColumn = 12; break; case "消费者": lastColumn = 16; break; case "资产": lastColumn = 18; break; case "资产领用": lastColumn = 21; break; default: Response.status = 1; Response.message = "上传活动名称有误"; return(Response); } //第3/4行获取名称基本信息 //List<string> nameList = new List<string>(); //List<string> basicInfo = new List<string>(); //for (int nameIndex = 0; nameIndex < lastColumn; nameIndex++) //{ // row = sheet.GetRow(2); // nameList.Add(row.GetCell(nameIndex).StringCellValue); //} //生成上传活动信息存入数据库 byte[] byteArray = new byte[file.ContentLength]; file.InputStream.Read(byteArray, 0, file.ContentLength); //fs.Read(byteArray, 0, Convert.ToInt32(fs.Length)); IRow row3 = sheet.GetRow(3); CodeActive codeActive = new CodeActive(); codeActive.AppId = "Excel文件上传"; codeActive.CorpCode = row3.GetCell(5).StringCellValue; codeActive.CorpName = row3.GetCell(4).StringCellValue; codeActive.SubCorpCode = row3.GetCell(6).StringCellValue; codeActive.ProductCode = row3.GetCell(8).StringCellValue; codeActive.ProductName = row3.GetCell(7).StringCellValue; codeActive.ProduceWorkline = row3.GetCell(6).StringCellValue; codeActive.ActivityName = activeName; codeActive.Amount = Convert.ToString(lastRowIndex - 2); codeActive.ActualQuantity = Convert.ToString(lastRowIndex - 2); codeActive.UploadDate = DateTime.Now; codeActive.Uploader = "CMC后台"; codeActive.ProcessType = 3; codeActive.Memo = row3.GetCell(9).StringCellValue; codeActive.ApplyId = 0; int activeID = CodeActiveUploadFactory.Instance.InsertNewActive(codeActive, byteArray); if (activeName == "激活") { List <ActiveCode> alist = new List <ActiveCode>(); //第4行开始获取数据 for (int index = 3; index <= lastRowIndex; index++) { //获取当前行 row = sheet.GetRow(index); //生成Mongo对象存码信息 ActiveCode c = new ActiveCode(); c.ActiveName = activeName; c.CreateDate = row.GetCell(2).DateCellValue;; c.ApplyId = codeActive.ApplyId; c.CodeActivityId = activeID; c.CorpCode = codeActive.CorpCode; c.SubCorpCode = codeActive.SubCorpCode; c.CorpName = codeActive.CorpName; try { c.Code = row.GetCell(0).StringCellValue; } catch { c.Code = row.GetCell(0).NumericCellValue.ToString(); } //c.MaskCode = row.GetCell(1).NumericCellValue.ToString(); c.ProductCode = row.GetCell(8).StringCellValue; c.ProductName = row.GetCell(7).StringCellValue; c.Memo = row.GetCell(9).StringCellValue; alist.Add(c); } string res = ReportFactory.Instance.SplitMongoInster <ActiveCode>(alist); if (res == "数据插入MongoDB失败") { Response.status = 0; this.Response.message = res + ",检查MongoDB是否正常"; return(Response); } } if (activeName == "营销") { List <SalesCode> alist = new List <SalesCode>(); //第4行开始获取数据 for (int index = 3; index <= lastRowIndex; index++) { //获取当前行 row = sheet.GetRow(index); //生成Mongo对象存码信息 SalesCode c = new SalesCode(); c.ActiveName = activeName; c.CreateDate = row.GetCell(2).DateCellValue;; c.ApplyId = codeActive.ApplyId; c.CodeActivityId = activeID; c.CorpCode = codeActive.CorpCode; c.SubCorpCode = codeActive.SubCorpCode; c.CorpName = codeActive.CorpName; try { c.Code = row.GetCell(0).StringCellValue; } catch { c.Code = row.GetCell(0).NumericCellValue.ToString(); } //c.MaskCode = row.GetCell(1).NumericCellValue.ToString(); c.ProductCode = row.GetCell(8).StringCellValue; c.ProductName = row.GetCell(7).StringCellValue; c.Memo = row.GetCell(9).StringCellValue; c.ActiveDescription = row.GetCell(10).StringCellValue; c.ActiveStartDate = row.GetCell(11).DateCellValue; c.ActiveEndDate = row.GetCell(12).DateCellValue; alist.Add(c); } string res = ReportFactory.Instance.SplitMongoInster <SalesCode>(alist); if (res == "数据插入MongoDB失败") { Response.status = 0; this.Response.message = res + ",检查MongoDB是否正常"; return(Response); } } if (activeName == "消费者") { List <CustomerCode> alist = new List <CustomerCode>(); //第4行开始获取数据 for (int index = 3; index <= lastRowIndex; index++) { //获取当前行 row = sheet.GetRow(index); //生成Mongo对象存码信息 CustomerCode c = new CustomerCode(); c.ActiveName = activeName; c.CreateDate = row.GetCell(2).DateCellValue;; c.ApplyId = codeActive.ApplyId; c.CodeActivityId = activeID; c.CorpCode = codeActive.CorpCode; c.SubCorpCode = codeActive.SubCorpCode; c.CorpName = codeActive.CorpName; try { c.Code = row.GetCell(0).StringCellValue; } catch { c.Code = row.GetCell(0).NumericCellValue.ToString(); } //c.MaskCode = row.GetCell(1).NumericCellValue.ToString(); c.ProductCode = row.GetCell(8).StringCellValue; c.ProductName = row.GetCell(7).StringCellValue; c.Memo = row.GetCell(9).StringCellValue; c.ActiveDescription = row.GetCell(10).StringCellValue; c.ActiveStartDate = row.GetCell(11).DateCellValue; c.ActiveEndDate = row.GetCell(12).DateCellValue; c.CustomerOpenID = row.GetCell(13).StringCellValue; c.CustomerTime = row.GetCell(14).DateCellValue; c.CustomerLocatio = row.GetCell(15).StringCellValue; c.WhatActive = row.GetCell(16).StringCellValue; alist.Add(c); } string res = ReportFactory.Instance.SplitMongoInster <CustomerCode>(alist); if (res == "数据插入MongoDB失败") { Response.status = 0; this.Response.message = res + ",检查MongoDB是否正常"; return(Response); } } if (activeName == "消费者") { List <CustomerCode> alist = new List <CustomerCode>(); //第4行开始获取数据 for (int index = 3; index <= lastRowIndex; index++) { //获取当前行 row = sheet.GetRow(index); //生成Mongo对象存码信息 CustomerCode c = new CustomerCode(); c.ActiveName = activeName; c.CreateDate = row.GetCell(2).DateCellValue;; c.ApplyId = codeActive.ApplyId; c.CodeActivityId = activeID; c.CorpCode = codeActive.CorpCode; c.SubCorpCode = codeActive.SubCorpCode; c.CorpName = codeActive.CorpName; c.Code = row.GetCell(0).NumericCellValue.ToString(); //c.MaskCode = row.GetCell(1).NumericCellValue.ToString(); c.ProductCode = row.GetCell(8).StringCellValue; c.ProductName = row.GetCell(7).StringCellValue; c.Memo = row.GetCell(9).StringCellValue; c.ActiveDescription = row.GetCell(10).StringCellValue; c.ActiveStartDate = row.GetCell(11).DateCellValue; c.ActiveEndDate = row.GetCell(12).DateCellValue; c.CustomerOpenID = row.GetCell(13).StringCellValue; c.CustomerTime = row.GetCell(14).DateCellValue; c.CustomerLocatio = row.GetCell(15).StringCellValue; c.WhatActive = row.GetCell(16).StringCellValue; alist.Add(c); } string res = ReportFactory.Instance.SplitMongoInster <CustomerCode>(alist); if (res == "数据插入MongoDB失败") { Response.status = 0; this.Response.message = res + ",检查MongoDB是否正常"; return(Response); } } if (activeName == "资产") { List <PropertyCode> alist = new List <PropertyCode>(); //第4行开始获取数据 for (int index = 3; index <= lastRowIndex; index++) { //获取当前行 row = sheet.GetRow(index); //生成Mongo对象存码信息 PropertyCode c = new PropertyCode(); c.ActiveName = activeName; c.CreateDate = row.GetCell(2).DateCellValue; c.ApplyId = codeActive.ApplyId; c.CodeActivityId = activeID; c.CorpCode = codeActive.CorpCode; c.SubCorpCode = codeActive.SubCorpCode; c.CorpName = codeActive.CorpName; try { c.Code = row.GetCell(0).StringCellValue; } catch { c.Code = row.GetCell(0).NumericCellValue.ToString(); } //c.MaskCode = row.GetCell(1).NumericCellValue.ToString(); c.ProductCode = row.GetCell(8).StringCellValue; c.ProductName = row.GetCell(7).StringCellValue; c.Memo = row.GetCell(9).StringCellValue; c.ProductProvider = row.GetCell(17).StringCellValue; c.ProductPurcheseDate = row.GetCell(18).DateCellValue; alist.Add(c); } string res = ReportFactory.Instance.SplitMongoInster <PropertyCode>(alist); if (res == "数据插入MongoDB失败") { Response.status = 0; this.Response.message = res + ",检查MongoDB是否正常"; return(Response); } } if (activeName == "资产领用") { List <PropertyUseCode> alist = new List <PropertyUseCode>(); //第4行开始获取数据 for (int index = 3; index <= lastRowIndex; index++) { //获取当前行 row = sheet.GetRow(index); //生成Mongo对象存码信息 PropertyUseCode c = new PropertyUseCode(); c.ActiveName = activeName; c.CreateDate = row.GetCell(2).DateCellValue; c.ApplyId = codeActive.ApplyId; c.CodeActivityId = activeID; c.CorpCode = codeActive.CorpCode; c.SubCorpCode = codeActive.SubCorpCode; c.CorpName = codeActive.CorpName; try { c.Code = row.GetCell(0).StringCellValue; } catch { c.Code = row.GetCell(0).NumericCellValue.ToString(); } //c.MaskCode = row.GetCell(1).NumericCellValue.ToString(); c.ProductCode = row.GetCell(8).StringCellValue; c.ProductName = row.GetCell(7).StringCellValue; c.Memo = row.GetCell(9).StringCellValue; c.ClaimDepartment = row.GetCell(19).StringCellValue; c.ClaimPerson = row.GetCell(20).StringCellValue; c.ClaimDate = row.GetCell(21).DateCellValue; alist.Add(c); } string res = ReportFactory.Instance.SplitMongoInster <PropertyUseCode>(alist); if (res == "数据插入MongoDB失败") { Response.status = 0; this.Response.message = res + ",检查MongoDB是否正常"; return(Response); } } } //删除文件 System.IO.File.Delete(fullPath); Response.status = 1; Response.message = "上传成功"; } catch (Exception e) { Response.status = 0; Response.message = e.Message; } return(Response); }
public async Task <bool> CustomerExists(CustomerCode code) { var request = new GetObservedDataRequest(code, new SensorTimestamp(), new SensorTimestamp()); return((await MakeRequestAsync(request)).IsSuccessStatusCode); }
public bool IsExist(CustomerCode costomerCode) { return(true); }
private bool Validate() { try { ItemValidator valItem = new ItemValidator(); NZString ItemCD = new NZString(this, Text); ErrorItem errorItem = null; string[] strItemTypes = null; //if (ItemType != null && ItemType.Length > 0) //{ // if (ItemType.Length == 1 && ItemType[0] == eItemType.All) // { // strItemTypes = new string[] { "01", "02", "03", "04" }; // } // else // { // strItemTypes = new string[ItemType.Length]; // for (int i = 0; i < ItemType.Length; i++) // { // strItemTypes[i] = string.Format("{0:00}", (int)ItemType[i]); // } // } //} if (CheckEmpty) { errorItem = valItem.CheckEmptyItemCode(ItemCD); } if (CheckExist) { ValidateException.ThrowErrorItem(valItem.CheckExistWithItemType(ItemCD, SqlOperator, strItemTypes)); } if (CheckNotExist) { ValidateException.ThrowErrorItem(valItem.CheckNotExistWithItemType(ItemCD, SqlOperator, strItemTypes)); //BusinessException businessException = valItem.CheckItemNotExist(ItemCD); //if (businessException != null) //{ // throw businessException; //} } if (CustomerCode != null && !"".Equals(CustomerCode)) { ValidateException.ThrowErrorItem(valItem.CheckItemByCustomer(ItemCD, CustomerCode.ToNZString())); } if (null != errorItem) { ValidateException.ThrowErrorItem(errorItem); } } catch (ValidateException err) { for (int i = 0; i < err.ErrorResults.Count; i++) { MessageDialog.ShowBusiness(this.FindForm(), err.ErrorResults[i].Message); err.ErrorResults[i].FocusOnControl(); } return(false); } catch (BusinessException err) { MessageDialog.ShowBusiness(this.FindForm(), err.Error.Message); err.Error.FocusOnControl(); return(false); } catch (Exception ex) { MessageDialog.ShowBusiness(this.FindForm(), ex.Message); return(false); } return(true); }
/// <summary> /// Returns true if Customer instances are equal /// </summary> /// <param name="other">Instance of Customer to be compared</param> /// <returns>Boolean</returns> public bool Equals(Customer other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( CustomerId == other.CustomerId || CustomerId != null && CustomerId.Equals(other.CustomerId) ) && ( CustomerCode == other.CustomerCode || CustomerCode != null && CustomerCode.Equals(other.CustomerCode) ) && ( CustomerName == other.CustomerName || CustomerName != null && CustomerName.Equals(other.CustomerName) ) && ( Email == other.Email || Email != null && Email.Equals(other.Email) ) && ( CompanyName == other.CompanyName || CompanyName != null && CompanyName.Equals(other.CompanyName) ) && ( CustomerGroupId == other.CustomerGroupId || CustomerGroupId != null && CustomerGroupId.Equals(other.CustomerGroupId) ) && ( DebitMoney == other.DebitMoney || DebitMoney.Equals(other.DebitMoney) ) && ( Address == other.Address || Address != null && Address.Equals(other.Address) ) && ( PhoneNumber == other.PhoneNumber || PhoneNumber != null && PhoneNumber.Equals(other.PhoneNumber) ) && ( DateOfBirth == other.DateOfBirth || DateOfBirth != null && DateOfBirth.Equals(other.DateOfBirth) )); }
public Task <IEnumerable <ApplianceActivityDto> > GetApplianceActivity(CustomerCode code) => Task.FromResult((IEnumerable <ApplianceActivityDto>) new List <ApplianceActivityDto>() { new ApplianceActivityDto() });
public void AddNewCustomer(String ccode, String cname) { CustomerCode.SendKeys(ccode); CustomerName.SendKeys(cname); SaveBtn.Click(); }
public Task <bool> CustomerExists(CustomerCode code) => Task.FromResult(_customers.Any(c => c.CustomerId.Code == code.Code));
public Task <ObservedDataResponse> GetCustomerAppliances(CustomerCode code, TimeInterval timeInterval, ushort intervalOffset = 0) => Task.FromResult(new ObservedDataResponse(1, 1, "0055_ALT-CM0102", "UK", new List <ObservedData>() { new ObservedData(10, new List <long>(), new List <ApplianceType>(), new List <short?>()) }));