protected void btnSaveSPChannel_Click(object sender, AjaxEventArgs e) { if (SPChannelWrapper.GetChannelByPath(this.txtFuzzyCommand.Text.Trim()) != null) { Coolite.Ext.Web.ScriptManager.AjaxSuccess = false; Coolite.Ext.Web.ScriptManager.AjaxErrorMessage = "错误信息:提交别名已存在!"; return; } try { SPChannelWrapper obj = new SPChannelWrapper(); obj.Name = this.txtName.Text.Trim(); obj.Description = this.txtDescription.Text.Trim(); obj.Area = this.txtArea.Text.Trim(); obj.ChannelCode = this.txtChannelCode.Text.Trim(); obj.FuzzyCommand = this.txtFuzzyCommand.Text.Trim(); obj.Port = this.txtPort.Value.ToString(); obj.ChannelType = this.txtChannelType.Text.Trim(); obj.Price = Convert.ToDecimal(this.txtPrice.Value); obj.Rate = Convert.ToInt32(this.txtRate.Value); if (this.cmbChannelCodeParamsName.SelectedItem != null) { obj.ChannelCodeParamsName = this.cmbChannelCodeParamsName.SelectedItem.Value; } else { obj.ChannelCodeParamsName = ""; } obj.IsAllowNullLinkID = chkIsAllowNullLinkID.Checked; obj.Status = 0; obj.CreateTime = System.DateTime.Now; obj.CreateBy = this.ParentPage.CurrentLoginUser.UserID; obj.OkMessage = txtOkMessage.Text.Trim(); obj.FailedMessage = txtFailedMessage.Text.Trim(); obj.RecStatReport = chkRecStatReport.Checked; obj.StatParamsName = txtStatParamName.Text.Trim(); obj.StatParamsValues = txtStatValues.Text.Trim(); obj.HasRequestTypeParams = chkHasRequestTypeParams.Checked; obj.RequestTypeParamName = txtRequestTypeParamName.Text.Trim(); obj.RequestTypeValues = txtRequestTypeValues.Text.Trim(); obj.HasFilters = chkHasFilters.Checked; obj.StatSendOnce = chkStatSendOnce.Checked; obj.IsMonitoringRequest = chkIsMonitoringRequest.Checked; SPChannelWrapper.Save(obj); obj.RefreshChannelInfo(); winSPChannelAdd.Hide(); } catch (Exception ex) { Coolite.Ext.Web.ScriptManager.AjaxSuccess = false; Coolite.Ext.Web.ScriptManager.AjaxErrorMessage = "错误信息:" + ex.Message; } }
protected void btnSaveSPChannel_Click(object sender, AjaxEventArgs e) { try { SPChannelWrapper obj = SPChannelWrapper.FindById(int.Parse(hidId.Text.Trim())); obj.Name = this.txtName.Text.Trim(); obj.Description = this.txtDescription.Text.Trim(); obj.Area = this.txtArea.Text.Trim(); obj.ChannelCode = this.txtChannelCode.Text.Trim(); if (this.cmbChannelCodeParamsName.SelectedItem != null) { obj.ChannelCodeParamsName = this.cmbChannelCodeParamsName.SelectedItem.Value; } else { obj.ChannelCodeParamsName = ""; } obj.IsAllowNullLinkID = chkIsAllowNullLinkID.Checked; obj.FuzzyCommand = this.txtFuzzyCommand.Text.Trim(); obj.Port = this.txtPort.Value.ToString(); obj.ChannelType = this.txtChannelType.Text.Trim(); obj.Price = Convert.ToDecimal(this.txtPrice.Value); obj.Rate = Convert.ToInt32(this.txtRate.Value); obj.Status = 0; obj.OkMessage = txtOkMessage.Text.Trim(); obj.FailedMessage = txtFailedMessage.Text.Trim(); obj.RecStatReport = chkRecStatReport.Checked; obj.StatParamsName = txtStatParamName.Text.Trim(); obj.StatParamsValues = txtStatValues.Text.Trim(); obj.HasConvertRule = chkHasConvertRule.Checked; obj.HasRequestTypeParams = chkHasRequestTypeParams.Checked; obj.RequestTypeParamName = txtRequestTypeParamName.Text.Trim(); obj.RequestTypeValues = txtRequestTypeValues.Text.Trim(); obj.HasFilters = chkHasFilters.Checked; obj.StatSendOnce = chkStatSendOnce.Checked; obj.IsMonitoringRequest = chkIsMonitoringRequest.Checked; SPChannelWrapper.Update(obj); obj.RefreshChannelInfo(); winSPChannelEdit.Hide(); } catch (Exception ex) { Coolite.Ext.Web.ScriptManager.AjaxSuccess = false; Coolite.Ext.Web.ScriptManager.AjaxErrorMessage = "错误信息:" + ex.Message; return; } }
protected void btnSaveSPSendClientParams_Click(object sender, AjaxEventArgs e) { try { string codeType = "1"; if (cmbCodeType.SelectedItem != null) { codeType = cmbCodeType.SelectedItem.Value; } SPChannelWrapper channelWrapper = SPChannelWrapper.FindById(ChannleID); string mainUserLoginID = this.txtLoginID.Text.Trim(); if (SystemUserWrapper.GetUserByLoginID(mainUserLoginID) != null) { Coolite.Ext.Web.ScriptManager.AjaxSuccess = false; Coolite.Ext.Web.ScriptManager.AjaxErrorMessage = "错误信息:用户登录ID“" + mainUserLoginID + "”已存在!"; return; } string subCode = this.txtSubCode.Text.Trim(); List <string> subcodes = new List <string>(); if (codeType == "2" && chkHasSubCode.Checked && !string.IsNullOrEmpty(subCode)) { subcodes.AddRange(subCode.Split('|')); } foreach (string scode in subcodes) { string subUserLoginID = mainUserLoginID + scode; if (SystemUserWrapper.GetUserByLoginID(subUserLoginID) != null) { Coolite.Ext.Web.ScriptManager.AjaxSuccess = false; Coolite.Ext.Web.ScriptManager.AjaxErrorMessage = "错误信息:用户登录ID“" + subUserLoginID + "”已存在!"; return; } } int mainloginuserID = AddClientUser(mainUserLoginID); List <CodeUserID> codeUserIds = new List <CodeUserID>(); foreach (string scode in subcodes) { CodeUserID codeUserID = new CodeUserID(); codeUserID.Code = scode; string subUserLoginID = mainUserLoginID + scode; codeUserID.UserID = AddClientUser(subUserLoginID); codeUserIds.Add(codeUserID); } SPClientWrapper.QuickAdd(this.txtLoginID.Text.Trim(), this.txtCode.Text.Trim(), channelWrapper, mainloginuserID, codeUserIds, txtChannelCode.Text.Trim(), Convert.ToInt32(this.numOrderIndex.Value), this.chkHasSubCode.Checked, codeType, this.txtAllowAndDisableArea.Text.Trim(), this.txtGetway.Text.Trim(), this.txtDayLimit.Text.Trim(), this.txtMonthLimit.Text.Trim(), this.txtSendText.Text.Trim()); channelWrapper.RefreshChannelInfo(); winSPChannelClientSetingQuickAdd.Hide(); } catch (Exception ex) { Coolite.Ext.Web.ScriptManager.AjaxSuccess = false; Coolite.Ext.Web.ScriptManager.AjaxErrorMessage = "错误信息:" + ex.Message; } }
protected void btnSaveSPChannel_Click(object sender, AjaxEventArgs e) { if (SPChannelWrapper.GetChannelByPath(this.txtFuzzyCommand.Text.Trim()) != null) { Coolite.Ext.Web.ScriptManager.AjaxSuccess = false; Coolite.Ext.Web.ScriptManager.AjaxErrorMessage = "错误信息:提交别名已存在!"; return; } string loginID = "default" + this.txtFuzzyCommand.Text.Trim(); if (SystemUserWrapper.GetUserByLoginID(loginID) != null) { Coolite.Ext.Web.ScriptManager.AjaxSuccess = false; Coolite.Ext.Web.ScriptManager.AjaxErrorMessage = "错误信息:用户登录ID已存在!"; return; } try { SPChannelWrapper obj = new SPChannelWrapper(); obj.Name = this.txtName.Text.Trim(); obj.Description = obj.Name; obj.Area = ""; obj.ChannelCode = this.txtChannelCode.Text.Trim(); obj.FuzzyCommand = this.txtFuzzyCommand.Text.Trim(); obj.Port = ""; obj.ChannelType = ""; obj.Price = 0; obj.Rate = 0; obj.ChannelCodeParamsName = "cpid"; obj.IsAllowNullLinkID = chkIsAllowNullLinkID.Checked; obj.Status = 0; obj.CreateTime = System.DateTime.Now; obj.CreateBy = this.ParentPage.CurrentLoginUser.UserID; obj.OkMessage = "ok"; obj.FailedMessage = "failed"; obj.RecStatReport = chkRecStatReport.Checked; obj.StatParamsName = txtStatParamName.Text.Trim(); obj.StatParamsValues = txtStatValues.Text.Trim(); obj.IsDisable = false; Membership.CreateUser(loginID, "123456", loginID + "@163.com"); SystemUserWrapper clientUser = SystemUserWrapper.GetUserByLoginID(loginID); clientUser.UserName = loginID; SystemUserWrapper.Update(clientUser); SystemRoleWrapper clientRole = SystemRoleWrapper.GetRoleByName("SPDownUser"); SystemUserWrapper.PatchAssignUserRoles(clientUser, new List <string> { clientRole.RoleID.ToString() }); SPChannelWrapper.QuickAdd(obj, this.txtLinkParamsName.Text.Trim(), this.txtMobileParamsName.Text.Trim(), this.txtSPcodeParamsName.Text.Trim(), this.txtMoParamsName.Text.Trim(), clientUser.UserID); obj.RefreshChannelInfo(); } catch (Exception ex) { Coolite.Ext.Web.ScriptManager.AjaxSuccess = false; Coolite.Ext.Web.ScriptManager.AjaxErrorMessage = "错误信息:" + ex.Message; } }
protected void btnSaveSPChannel_Click(object sender, AjaxEventArgs e) { if (SPChannelWrapper.GetChannelByPath(this.txtFuzzyCommand.Text.Trim()) != null) { Coolite.Ext.Web.ScriptManager.AjaxSuccess = false; Coolite.Ext.Web.ScriptManager.AjaxErrorMessage = "错误信息:提交别名已存在!"; return; } string loginID = "default" + this.txtFuzzyCommand.Text.Trim(); if (SystemUserWrapper.GetUserByLoginID(loginID) != null) { Coolite.Ext.Web.ScriptManager.AjaxSuccess = false; Coolite.Ext.Web.ScriptManager.AjaxErrorMessage = "错误信息:用户登录ID已存在!"; return; } try { SPChannelWrapper obj = new SPChannelWrapper(); obj.Name = this.txtName.Text.Trim(); obj.Description = obj.Name; obj.Area = ""; obj.ChannelCode = this.txtChannelCode.Text.Trim(); obj.FuzzyCommand = this.txtFuzzyCommand.Text.Trim(); obj.Port = ""; obj.ChannelType = ""; obj.Price = 0; obj.Rate = 0; obj.ChannelCodeParamsName = "cpid"; obj.IsAllowNullLinkID = chkIsAllowNullLinkID.Checked; obj.Status = 0; obj.CreateTime = System.DateTime.Now; obj.CreateBy = this.ParentPage.CurrentLoginUser.UserID; obj.OkMessage = "ok"; obj.FailedMessage = "failed"; obj.RecStatReport = false; obj.StatParamsName = ""; obj.StatParamsValues = ""; obj.IsDisable = false; Uri url = new Uri(obj.InterfaceUrl); string fileName = Path.GetFileName(url.AbsolutePath); string saveivrPath = HttpContext.Current.Server.MapPath("~/SPSInterface/") + fileName; if (obj.FuzzyCommand.ToLower().EndsWith("ivr")) { if (!File.Exists(saveivrPath)) { File.WriteAllText(saveivrPath, "", Encoding.UTF8); } } Membership.CreateUser(loginID, "123456", loginID + "@163.com"); SystemUserWrapper clientUser = SystemUserWrapper.GetUserByLoginID(loginID); clientUser.UserName = loginID; SystemUserWrapper.Update(clientUser); SystemRoleWrapper clientRole = SystemRoleWrapper.GetRoleByName("SPDownUser"); SystemUserWrapper.PatchAssignUserRoles(clientUser, new List <string> { clientRole.RoleID.ToString() }); //SPChannelWrapper.QuickAddIVR(); SPChannelWrapper.QuickAddIVR(obj, this.txtLinkParamsName.Text.Trim(), this.txtMobileParamsName.Text.Trim(), this.txtSPcodeParamsName.Text.Trim() , this.txtStartTimeParamsName.Text.Trim() , this.txtEndTimeParamsName.Text.Trim() , this.txtFeeTimeParamsName.Text.Trim() , clientUser.UserID); obj.RefreshChannelInfo(); } catch (Exception ex) { Coolite.Ext.Web.ScriptManager.AjaxSuccess = false; Coolite.Ext.Web.ScriptManager.AjaxErrorMessage = "错误信息:" + ex.Message; } }