static void Main(string[] args) { PinYin p = new PinYin(); Console.WriteLine(p.GetChineseSpell("甲乙丙丁")); Console.WriteLine(p.GetChineseSpell("重量")); Console.WriteLine(p.GetChineseSpell("重庆")); p.Test('国'); p.Test('重'); Console.ReadLine(); }
protected void btnChangeCustCode_Click(object sender, EventArgs e) { CustomerService svr = new CustomerService(); DataTable dt = svr.GetCustomer(); string custCode = ""; for (int i = 0; i < dt.Rows.Count; i++) { custCode = PinYin.GetChineseSpell(dt.Rows[i]["CustName"].ToString()); svr.dataCtx.ExecuteCommand("update crmcustomer set custcode='" + custCode + "' where custID=" + dt.Rows[i]["CustID"]); } }
//获取输入数据 private CRMCustomer GetSaveEntity() { var entity = new CRMCustomer(); if (string.IsNullOrEmpty(hidID.Value.Trim()) == false) { entity.CustID = int.Parse(hidID.Value.Trim()); } //现在CustCode改成自动生成 //if (string.IsNullOrEmpty(txtCustCode.Text.Trim()) == false) // entity.CustCode = txtCustCode.Text.Trim(); entity.CustCode = PinYin.GetChineseSpell(txtCustName.Text); if (string.IsNullOrEmpty(txtCustName.Text.Trim()) == false) { entity.CustName = txtCustName.Text.Trim(); } if (string.IsNullOrEmpty(txtCustFullName.Text.Trim()) == false) { entity.CustFullName = txtCustFullName.Text.Trim(); } if (string.IsNullOrEmpty(txtCustTypeID.Text.Trim()) == false) { entity.CustTypeID = int.Parse(txtCustTypeID.Text.Trim()); } if (string.IsNullOrEmpty(txtCustRelationID.Text.Trim()) == false) { entity.CustRelationID = int.Parse(txtCustRelationID.Text.Trim()); } if (string.IsNullOrEmpty(txtCustIndustryID.Text.Trim()) == false) { entity.CustIndustryID = int.Parse(txtCustIndustryID.Text.Trim()); } if (string.IsNullOrEmpty(txtCustEmpNumID.Text.Trim()) == false) { entity.CustEmpNumID = int.Parse(txtCustEmpNumID.Text.Trim()); } if (string.IsNullOrEmpty(txtCustInfo.Text.Trim()) == false) { entity.CustInfo = txtCustInfo.Text.Trim(); } if (string.IsNullOrEmpty(txtCustCountryID.Text.Trim()) == false) { entity.CustCountryID = int.Parse(txtCustCountryID.Text.Trim()); } //只有选择了其他,才用textbox的值 if (ddlProvince.Text == "其他") { if (string.IsNullOrEmpty(txtCustProvince.Text.Trim()) == false) { entity.CustProvince = txtCustProvince.Text.Trim(); } } else { entity.CustProvince = ddlProvince.Text; } if (string.IsNullOrEmpty(txtCustCity.Text.Trim()) == false) { entity.CustCity = txtCustCity.Text.Trim(); } if (string.IsNullOrEmpty(txtCustDistinct.Text.Trim()) == false) { entity.CustDistinct = txtCustDistinct.Text.Trim(); } if (string.IsNullOrEmpty(txtCustAddress.Text.Trim()) == false) { entity.CustAddress = txtCustAddress.Text.Trim(); } if (string.IsNullOrEmpty(txtCustTel.Text.Trim()) == false) { entity.CustTel = txtCustTel.Text.Trim(); } if (string.IsNullOrEmpty(txtCustFax.Text.Trim()) == false) { entity.CustFax = txtCustFax.Text.Trim(); } if (string.IsNullOrEmpty(txtCustWeb.Text.Trim()) == false) { entity.CustWeb = txtCustWeb.Text.Trim(); } if (string.IsNullOrEmpty(txtCustEmail.Text.Trim()) == false) { entity.CustEmail = txtCustEmail.Text.Trim(); } if (string.IsNullOrEmpty(txtCustCDate.Text.Trim()) == false) { entity.CustCDate = DateTime.Parse(txtCustCDate.Text.Trim()); } if (string.IsNullOrEmpty(txtCustCUserID.Value.Trim()) == false) { entity.CustCUserID = int.Parse(txtCustCUserID.Value.Trim()); } if (string.IsNullOrEmpty(txtCustOwnerID.Text.Trim()) == false) { entity.CustOwnerID = int.Parse(txtCustOwnerID.Text.Trim()); } if (string.IsNullOrEmpty(txtSYSID.Text.Trim()) == false) { entity.SYSID = int.Parse(txtSYSID.Text.Trim()); } if (string.IsNullOrEmpty(txtArrivalPort.Text.Trim()) == false) { entity.CustPort = txtArrivalPort.Text.Trim(); } if (string.IsNullOrEmpty(txtPayMethod.Text.Trim()) == false) { entity.CustPayMethod = txtPayMethod.Text; } if (string.IsNullOrEmpty(txtPurchaseChannels.Text.Trim()) == false) { entity.CustPurchaseChannels = txtPurchaseChannels.Text; } if (string.IsNullOrEmpty(txtSaleChannels.Text.Trim()) == false) { entity.CustSaleChannels = txtSaleChannels.Text; } if (string.IsNullOrEmpty(txtMaterial.Text.Trim()) == false) { entity.CustMaterial = txtMaterial.Text; } entity.CustModifyDate = DateTime.Now; entity.CustModifyUserID = base.LoginUserID; //entity.CustBidPrice = txtBidPrice.Text; double cf = 0.0; double.TryParse(txtCommissionFactor.Text, out cf); entity.CommissionFactor = cf; entity.CustProduct = txtCustProduct.Text; entity.IsActive = true; //??还没想好Status字段用途,P,A,还是审批流程步骤1,2,3,4 entity.Status = "A"; //Ticket Fields if (string.IsNullOrEmpty(ddlGender.Text) == false) { entity.Gender = ddlGender.SelectedValue; } if (string.IsNullOrEmpty(txtBirthday.Text) == false) { entity.BirthDay = Convert.ToDateTime(txtBirthday.Text); } if (string.IsNullOrEmpty(ddlPreferPrice.Text) == false) { entity.PreferPrice = ddlPreferPrice.Text; } if (string.IsNullOrEmpty(ddlUseOwnMoney.Text) == false) { entity.UseOwnMoney = Convert.ToBoolean(ddlUseOwnMoney.Text); } if (string.IsNullOrEmpty(ddlRequireVisa.Text) == false) { entity.RequireVisa = Convert.ToBoolean(ddlRequireVisa.Text); } if (string.IsNullOrEmpty(txtFavoriteDest.Text) == false) { entity.FavoriteDest = txtFavoriteDest.Text; } if (string.IsNullOrEmpty(txtFavoriteProd.Text) == false) { entity.FavoriteProd = txtFavoriteProd.Text; } if (string.IsNullOrEmpty(txtPreferPlace.Text) == false) { entity.PreferPlace = txtPreferPlace.Text; } if (string.IsNullOrEmpty(txtBudget.Text) == false) { entity.Budget = txtBudget.Text; } if (string.IsNullOrEmpty(txtPosition.Text) == false) { entity.Position = txtPosition.Text; } if (string.IsNullOrEmpty(txtParentCompany.Text) == false) { entity.ParentCompany = txtParentCompany.Text; } if (string.IsNullOrEmpty(txtPassport.Text) == false) { entity.Passport = txtPassport.Text; } if (string.IsNullOrEmpty(txtPassportExpiryDate.Text) == false) { entity.PassportExpiryDate = txtPassportExpiryDate.Text; } if (string.IsNullOrEmpty(chkTravelDay.Text) == false) { entity.TravelDay = chkTravelDay.GetChecked(","); } entity.BuddyList = BuddyList1.strBuddyList; return(entity); }
private void txtName_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (txtName.Text != string.Empty) { PinYin py = new PinYin(txtName.Text.Trim()); string strShort = py.GetChineseSpell(); this.txtHelpCode.Text = strShort; txtHelpCode.Focus(); } } }