public bool Update(int?Id, CustomerParam customerParam) { var result = 0; var customer = Get(Id); customer.FirstName = customerParam.FirstName; customer.LastName = customerParam.LastName; customer.Dob = customerParam.Dob; customer.Pob = customerParam.Pob; customer.Gender = customerParam.Gender; customer.Religions = myContext.Religions.Find(customerParam.Religions); customer.Villages = myContext.Villages.Find(customerParam.Villages); customer.Address = customerParam.Address; customer.Phone = customerParam.Phone; customer.Email = customerParam.Email; customer.Username = customerParam.Username; customer.Password = customerParam.Password; customer.SecretQuestion = customerParam.SecretQuestion; customer.SecretAnswer = customerParam.SecretAnswer; customer.UpdateDate = DateTimeOffset.UtcNow.LocalDateTime; result = myContext.SaveChanges(); if (result > 0) { status = true; } return(status); }
protected void btnSearch_Click(object sender, ImageClickEventArgs e) { try { CustomerParam cstpara = new CustomerParam(); if (!string.IsNullOrEmpty(this.txtKHID.Text)) { cstpara.KHID = this.txtKHID.Text.Trim(); } if (!string.IsNullOrEmpty(this.txtKHName.Text)) { cstpara.KHName = this.txtKHName.Text.Trim(); } DataSet ds = cstpara.GetListByEnter(); if (ds != null) { this.grdKHInfo.DataSource = ds; this.grdKHInfo.DataBind(); } } catch (Exception ex) { String strEx = ex.Message; this.PrintfError("数据访问错误,请重试!"); return; } }
public override void SetParameter(CustomerParam parameter, string name, DataType dataType, object value) { switch (dataType) { case DataType.Decimal: case DataType.VarNumeric: if (value != null && value.GetType() == _mySqlDecimalType) { value = _mySqlDecimalValueGetter(value); } break; case DataType.Date: case DataType.DateTime: case DataType.DateTime2: if (value != null && value.GetType() == _mySqlDateTimeType) { value = _mySqlDateTimeValueGetter(value); } break; case DataType.Char: case DataType.NChar: if (value is char) { value = value.ToString(); } break; } if (value != null) { parameter.ParameterType = value.GetType(); } base.SetParameter(parameter, name, dataType, value); }
static Dictionary <string, CustomerParam> SetParameters(DataConnection dataConnection, DataParameter[] parameters) { var result = new Dictionary <string, CustomerParam>(); if (parameters == null) { return(result); } foreach (var parameter in parameters) { var p = new CustomerParam(); //p = dataConnection.Command.CreateParameter(); var dataType = parameter.DataType; var value = parameter.Value; if (dataType == DataType.Undefined && value != null) { dataType = dataConnection.MappingSchema.GetDataType(value.GetType()).DataType; } //if (parameter.Direction != null) p.Direction = parameter.Direction.Value; //if (parameter.Size != null) p.Size = parameter.Size. Value; dataConnection.DataProvider.SetParameter(p, parameter.Name, dataType, value); p.ParameterName = parameter.Name; p.DbType = DataTypeConvert.Convert(dataType); result.Add(parameter.Name.StartsWith("@")? parameter.Name : "@" + parameter.Name, p); //dataConnection.Command.Parameters.Add(p); } return(result); }
public CustomerResult Create(CustomerParam param) { Data.Entity.Customer entity = CustomerParamConverter.Convert(param, null); CustomerDao.Save(entity); return(CustomerResultConverter.Convert(entity)); }
public bool Update(int?Id, CustomerParam customerParam) { if (Id != null && customerParam != null) { status = _customerRepository.Update(Id, customerParam); } return(status); }
public bool Insert(CustomerParam customerParam) { if (customerParam != null) { status = _customerRepository.Insert(customerParam); } return(status); }
public override void SetParameter(CustomerParam parameter, string name, DataType dataType, object value) { switch (dataType) { case DataType.Decimal: case DataType.VarNumeric: if (value != null && value.GetType() == _mySqlDecimalType) { value = _mySqlDecimalValueGetter(value); } break; case DataType.Date: case DataType.DateTime: case DataType.DateTime2: if (value != null && value.GetType() == _mySqlDateTimeType) { value = _mySqlDateTimeValueGetter(value); } //else if (value is DateTime) //{ // var dt = (DateTime)value; // value = dt.ToString( // dt.Millisecond == 0 // ? dt.Hour == 0 && dt.Minute == 0 && dt.Second == 0 // ? "yyyy-MM-dd" // : "yyyy-MM-dd HH:mm:ss" // : "yyyy-MM-dd HH:mm:ss.fff"); //} //else if (value is TimeSpan) //{ // var ts = (TimeSpan)value; // value = ts.ToString( // ts.Days > 0 // ? ts.Milliseconds > 0 // ? "d\\.hh\\:mm\\:ss\\.fff" // : "d\\.hh\\:mm\\:ss" // : ts.Milliseconds > 0 // ? "hh\\:mm\\:ss\\.fff" // : "hh\\:mm\\:ss"); //} break; case DataType.Char: case DataType.NChar: if (value is char) { value = value.ToString(); } break; } if (value != null) { parameter.ParameterType = value.GetType(); } base.SetParameter(parameter, name, dataType, value); }
public CustomerDto RegisterCustomer(CustomerParam param) { #region Proceso var result = _model.RegisterCustomer(param); return(result); #endregion }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindGrid(); CustomerParam customer = new CustomerParam(); sumid = KHInfo.GetKHCount().ToString(); //Response.Write(sumid); } }
public List <Customer> GetCustomerList(CustomerParam param) { Expression <Func <Customer, bool> > filter = p => true; filter = filter.AndIf(p => p.CustomerCode == param.CustomerCode, !string.IsNullOrWhiteSpace(param.CustomerCode)); return(_customerRepository.GetList(filter)); }
public CustomerDto RegisterCustomer(CustomerParam param) { var result = new CustomerDto(); result.Response = false; try { #region Validaciones if (String.IsNullOrEmpty(param.FirstName)) { result.Messages.Add(new Error() { Message = recurso.FirstName }); } if (String.IsNullOrEmpty(param.SurName)) { result.Messages.Add(new Error() { Message = recurso.SurName }); } if (String.IsNullOrEmpty(param.Email)) { result.Messages.Add(new Error() { Message = recurso.Email }); } if (result.Messages.Count == 0) { result.Response = true; } #endregion } catch (Exception ex) { result.Messages.Add(new Error() { Message = ex.Message }); } return(result); }
public JsonResult GetSelectCustomerByParam(string keyword, bool IsAll) { CustomerParam param = new CustomerParam(); if (!string.IsNullOrWhiteSpace(keyword)) { param.CustomerCode = keyword; } var list = _customerService.GetCustomerList(param.CustomerCode, IsAll) .ToModelAsCollection <Customer, CustomerModel>(); return(Json(list, JsonRequestBehavior.AllowGet)); }
private CustomerViewModel CustomerDataBind(CustomerFilterModel filterModel) { CustomerViewModel viewModel = new CustomerViewModel(); CustomerParam param = new CustomerParam(); viewModel.FilterModel = filterModel; if (!string.IsNullOrWhiteSpace(filterModel.CustomerCode)) { param.CustomerCode = filterModel.CustomerCode; } viewModel.CustomerModels = _customerService.GetCustomerList(param.CustomerCode, filterModel.IsAll) .ToModelAsCollection <Customer, CustomerModel>(); return(viewModel); }
/// <summary> /// 个人客户信息查询 /// </summary> /// <param name="param"></param> /// <returns></returns> public static CustomerInfo QueryCustomerInfo(CustomerParam param) { CustomerInfo info = null; Dictionary <String, String> parameters = new Dictionary <String, String>(); parameters.Add("selcnt", param.selcnt); parameters.Add("seltype", param.seltype); parameters.Add("pwd", param.pwd); parameters.Add("appId", param.Id); parameters.Add("conName", param.conName); string jsonText = HttpHelper.getHttp(SysConfigHelper.readerNode("accumulationFund"), parameters, null); //反序列化JSON字符串,将JSON字符串转换成LIST列表 info = JsonConvert.DeserializeObject <CustomerInfo>(jsonText); if (jsonText.IndexOf("密码错误") > 0) { info.recode = "9999"; info.msg = "密码错误"; } if (jsonText.IndexOf("个人信息不存在") > 0) { info.recode = "9999"; info.msg = "个人信息不存在"; } if (jsonText.IndexOf("身份证号不正确") > 0) { info.recode = "9999"; info.msg = "身份证号不正确"; } if (jsonText.IndexOf("未查到相关信息,请核对查询信息") > 0) { info.recode = "9999"; info.msg = "未查到相关信息,请核对查询信息"; } if (jsonText.IndexOf("社保卡号密码错误") > 0) { info.recode = "9999"; info.msg = "社保卡号密码错误,请检查"; } if (jsonText.IndexOf("查询信息不存在") > 0) { info.recode = "9999"; info.msg = "查询信息不存在"; } return(info); }
private void BindKHParam() { try { DataSet ds = CustomerParam.GetList(""); if (ds != null) { this.grdKHInfo.DataSource = ds; this.grdKHInfo.DataBind(); } } catch (Exception ex) { String strEx = ex.Message; this.PrintfError("数据访问错误,请重试!"); } }
//绑定Gridview1 private void BindGrid() { try { DataSet ds = CustomerParam.GetList(""); if (ds != null) { this.GridView1.DataSource = ds; this.GridView1.DataBind(); } } catch { this.PrintfError("连接数据库出错,请重试!"); return; } }
public JsonResult GetSelectCustomerByParam(string keyword, bool IsAll, bool?onlyShowCash) { CustomerParam param = new CustomerParam(); if (!string.IsNullOrWhiteSpace(keyword)) { param.CustomerCode = keyword; } var list = _customerService.GetCustomerList(param.CustomerCode, IsAll).ToModelAsCollection <Customer, CustomerModel>(); var listPaymentType = GetPaymentTypeList(); if (onlyShowCash == true) { list.RemoveAll(p => p.PaymentTypeID != 3 && p.PaymentTypeID != 4); } list.ForEach(p => p.PaymentName = listPaymentType.Find(r => r.SelectValue == p.PaymentTypeID.ToString()) == null ? "" : listPaymentType.Find(r => r.SelectValue == p.PaymentTypeID.ToString()).SelectName); return(Json(list, JsonRequestBehavior.AllowGet)); }
CustomerParam AddParameter(ICollection <IDbDataParameter> parms, string name, SqlParameter parm) { var p = new CustomerParam(); var dataType = parm.DataType; if (dataType == DataType.Undefined) { dataType = MappingSchema.GetDataType( parm.SystemType == typeof(object) && parm.Value != null ? parm.Value.GetType() : parm.SystemType).DataType; } DataProvider.SetParameter(p, name, dataType, parm.Value); p.DbType = DataTypeConvert.Convert(dataType); return(p); ; }
private CustomerViewModel CustomerDataBind(CustomerFilterModel filterModel) { CustomerViewModel viewModel = new CustomerViewModel(); CustomerParam param = new CustomerParam(); viewModel.FilterModel = filterModel; if (!string.IsNullOrWhiteSpace(filterModel.CustomerCode)) { param.CustomerCode = filterModel.CustomerCode; } viewModel.CustomerModels = _customerService.GetCustomerList(param.CustomerCode).ToModelAsCollection <Customer, CustomerModel>(); var listPaymentType = GetPaymentTypeList(); if (filterModel.OnlyShowCash == true) { viewModel.CustomerModels.RemoveAll(p => p.PaymentTypeID != 3 && p.PaymentTypeID != 4); } viewModel.CustomerModels.ForEach(p => p.PaymentName = listPaymentType.Find(r => r.SelectValue == p.PaymentTypeID.ToString()) == null?"":listPaymentType.Find(r => r.SelectValue == p.PaymentTypeID.ToString()).SelectName); return(viewModel); }
public ApiResponse Create(CustomerParam param) { CustomerProcessor = new CustomerProcessor(); Response = new ApiResponse(); try { Response.text = JsonConverter.JsonConverter.ObjToJson(CustomerProcessor.Create(param)); Response.result = true; return(Response); } catch { Response.text = "Something went wrong :("; Response.result = false; return(Response); } }
public ApiResponse Update(long id, CustomerParam param) { CustomerProcessor = new CustomerProcessor(); Response = new ApiResponse(); try { CustomerProcessor.Update(id, param); Response.text = "Entity was successfully updated"; Response.result = true; return(Response); } catch { Response.text = "Unfortunately something went wrong :("; Response.result = false; return(Response); } }
public async Task <ApiResult <PagedData <Customer> > > GetCustomers([FromBody] CustomerParam m) { var profile = this.GetUserProfile(); Expression <Func <Customer, bool> > condition = x => x.Tenant.Id == profile.Tenant; //var f = from c in _context.Customer where c.Tenant.Id == select c; //if (!f.Any()) //{ // return NotFound(new ApiResult(ApiCode.NotFoundCustomer, "This tenant does not have any customers")); //} //else //{ // return await f.ToArrayAsync(); //} return(new ApiResult <PagedData <Customer> >(ApiCode.Success, "OK", new PagedData <Customer> { total = await _context.Customer.CountAsync(condition), rows = await _context.Customer.OrderByDescending(c => c.Id).Where(condition).Skip((m.offset) * m.limit).Take(m.limit).ToListAsync() })); }
public CustomerDto RegisterCustomer(CustomerParam param) { var result = new CustomerDto(); try { #region Proceso result = _customer.RegisterCustomer(param); #endregion } catch (Exception Ex) { result.Messages.Add(new Error() { Message = Ex.Message }); } return(result); }
public virtual void SetParameter(CustomerParam parameter, string name, DataType dataType, object value) { switch (dataType) { case DataType.Char: case DataType.NChar: case DataType.VarChar: case DataType.NVarChar: case DataType.Text: case DataType.NText: if (value is DateTimeOffset) { value = ((DateTimeOffset)value).ToString("yyyy-MM-ddTHH:mm:ss.ffffff zzz"); } else if (value is DateTime) { var dt = (DateTime)value; value = dt.ToString( dt.Millisecond == 0 ? dt.Hour == 0 && dt.Minute == 0 && dt.Second == 0 ? "yyyy-MM-dd" : "yyyy-MM-ddTHH:mm:ss" : "yyyy-MM-ddTHH:mm:ss.fff"); } else if (value is TimeSpan) { var ts = (TimeSpan)value; value = ts.ToString( ts.Days > 0 ? ts.Milliseconds > 0 ? "d\\.hh\\:mm\\:ss\\.fff" : "d\\.hh\\:mm\\:ss" : ts.Milliseconds > 0 ? "hh\\:mm\\:ss\\.fff" : "hh\\:mm\\:ss"); } break; case DataType.Image: case DataType.Binary: case DataType.Blob: case DataType.VarBinary: if (value is Binary) { value = ((Binary)value).ToArray(); } break; case DataType.Int64: if (value is TimeSpan) { value = ((TimeSpan)value).Ticks; } break; case DataType.Xml: if (value is XDocument) { value = value.ToString(); } else if (value is XmlDocument) { value = ((XmlDocument)value).InnerXml; } break; } parameter.ParameterName = name; parameter.Value = value ?? DBNull.Value; }
public void Update(long id, CustomerParam param) { Data.Entity.Customer oldEntity = CustomerDao.Find(id); Data.Entity.Customer newEntity = CustomerParamConverter.Convert(param, null); CustomerDao.Update(newEntity); }
/// <summary> /// 个人公积金贷款余额查询 /// </summary> /// <param name="param"></param> /// <returns></returns> public static LoanBalanceInfo QueryLoanBalanceInfo(CustomerParam param) { LoanBalanceInfo info = new LoanBalanceInfo(); try { Dictionary <String, String> parameters = new Dictionary <String, String>(); parameters.Add("selcnt", param.selcnt); parameters.Add("seltype", param.seltype); parameters.Add("pwd", param.pwd); parameters.Add("appId", param.Id); parameters.Add("conName", param.conName); string jsonText = HttpHelper.getHttp(SysConfigHelper.readerNode("accumulationFund"), parameters, null); JObject json = (JObject)JsonConvert.DeserializeObject(jsonText); if (json == null) { return(null); } if (json["msg"] != null) { if (json["msg"].ToString().Length >= 4) { info.msg = json["msg"].ToString(); } else { info.msg = "查询失败..."; } } if (jsonText.IndexOf("密码错误") > 0) { info.recode = "9999"; info.msg = "密码错误"; } if (jsonText.IndexOf("个人信息不存在") > 0) { info.recode = "9999"; info.msg = "个人信息不存在"; } if (jsonText.IndexOf("身份证号不正确") > 0) { info.recode = "9999"; info.msg = "身份证号不正确"; } if (jsonText.IndexOf("未查到相关信息,请核对查询信息") > 0) { info.recode = "9999"; info.msg = "未查到相关信息,请核对查询信息"; } if (jsonText.IndexOf("社保卡号密码错误") > 0) { info.recode = "9999"; info.msg = "社保卡号密码错误,请检查"; } if (jsonText.IndexOf("查询信息不存在") > 0) { info.recode = "9999"; info.msg = "查询信息不存在"; } info.data = new LoanBalanceInfoData(); info.data.pername = json["data"]["pername"].ToString(); info.data.percode = json["data"]["percode"].ToString(); info.data.cardtype = json["data"]["cardtype"].ToString(); info.data.cardcode = json["data"]["cardcode"].ToString(); info.data.agrcode = json["data"]["agrcode"].ToString(); info.data.payacc = json["data"]["payacc"].ToString(); info.data.loanmny = json["data"]["loanmny"].ToString(); info.data.loanbal = json["data"]["loanbal"].ToString(); info.data.payedmths = json["data"]["payedmths"].ToString(); info.data.overmths = json["data"]["overmths"].ToString(); info.data.lastpaydate = json["data"]["lastpaydate"].ToString(); info.data.totoalmny = json["data"]["totoalmny"].ToString(); info.data.corpus = json["data"]["corpus"].ToString(); info.data.interests = json["data"]["interests"].ToString(); info.data.overmny = json["data"]["overmny"].ToString(); info.dateTime = json["dateTime"].ToString(); info.success = json["success"].ToString(); // info.u = json["u"].ToString(); } catch { } return(info); }
/// <summary> /// 个人公积金账户查询 /// </summary> /// <param name="param"></param> /// <returns></returns> public static PublicAccountInfo QueryPublicAccountInfo(CustomerParam param) { PublicAccountInfo info = new PublicAccountInfo(); try { Dictionary <String, String> parameters = new Dictionary <String, String>(); parameters.Add("selcnt", param.selcnt); parameters.Add("seltype", param.seltype); parameters.Add("pwd", param.pwd); parameters.Add("appId", param.Id); parameters.Add("conName", param.conName); string jsonText = HttpHelper.getHttp(SysConfigHelper.readerNode("accumulationFund"), parameters, null); JObject json = (JObject)JsonConvert.DeserializeObject(jsonText); if (json == null) { return(null); } if (json["msg"] != null) { if (json["msg"].ToString().Length >= 4) { info.msg = json["msg"].ToString(); } else { info.msg = "查询失败..."; } } if (jsonText.IndexOf("密码错误") > 0) { info.recode = "9999"; info.msg = "密码错误"; } if (jsonText.IndexOf("个人信息不存在") > 0) { info.recode = "9999"; info.msg = "个人信息不存在"; } if (jsonText.IndexOf("身份证号不正确") > 0) { info.recode = "9999"; info.msg = "身份证号不正确"; } if (jsonText.IndexOf("未查到相关信息,请核对查询信息") > 0) { info.recode = "9999"; info.msg = "未查到相关信息,请核对查询信息"; } if (jsonText.IndexOf("社保卡号密码错误") > 0) { info.recode = "9999"; info.msg = "社保卡号密码错误,请检查"; } if (jsonText.IndexOf("查询信息不存在") > 0) { info.recode = "9999"; info.msg = "查询信息不存在"; } PublicAccountInfoDatas list = null; if (json["data"].Count() >= 1) { info.data = new List <PublicAccountInfoDatas>(); JObject data = (JObject)JsonConvert.DeserializeObject(json["data"].ToString()); for (int i = 1; i <= data.Count; i++) { list = new PublicAccountInfoDatas(); list.data1 = data["data" + i]["data1"].ToString(); list.data2 = data["data" + i]["data2"].ToString(); list.data3 = data["data" + i]["data3"].ToString(); list.data4 = data["data" + i]["data4"].ToString(); list.data5 = data["data" + i]["data5"].ToString(); list.data6 = data["data" + i]["data6"].ToString(); list.data7 = data["data" + i]["data7"].ToString(); list.data8 = data["data" + i]["data8"].ToString(); list.data9 = data["data" + i]["data9"].ToString(); info.data.Add(list); } } info.dateTime = json["dateTime"].ToString(); info.success = json["success"].ToString(); info.u = json["u"].ToString(); }catch (Exception ex) { } return(info); }
// POST: api/Priorities public void Post(CustomerParam customerParam) { _customerService.Insert(customerParam); }
// PUT: api/Priorities/5 public void Put(int id, CustomerParam customerParam) { _customerService.Update(id, customerParam); }