protected void btnSaveSPClientGroup_Click(object sender, AjaxEventArgs e)
        {
            string loginID = this.txtUserID.Text.Trim();

            if (SystemUserWrapper.GetUserByLoginID(loginID) != null)
            {
                Coolite.Ext.Web.ScriptManager.AjaxSuccess      = false;
                Coolite.Ext.Web.ScriptManager.AjaxErrorMessage = "错误信息:用户登录ID已存在!";
                return;
            }



            try
            {
                SPClientGroupWrapper obj = new SPClientGroupWrapper();
                obj.Name                    = this.txtName.Text.Trim();
                obj.Description             = this.txtDescription.Text.Trim();
                obj.DefaultSycnMoUrl        = this.txtDefaultSycnMoUrl.Text.Trim();
                obj.DefaultInterceptRate    = Convert.ToInt32(this.txtDefaultInterceptRate.Text);
                obj.DefaultNoInterceptCount = Convert.ToInt32(this.txtDefaultNoInterceptCount.Text);

                if (cmbSelectAssignedUser.SelectedItem != null && !string.IsNullOrEmpty(cmbSelectAssignedUser.SelectedItem.Value))
                {
                    obj.AssignedUserID = Convert.ToInt32(cmbSelectAssignedUser.SelectedItem.Value);
                }
                else
                {
                    obj.AssignedUserID = null;
                }


                Membership.CreateUser(loginID, this.txtUserPass.Text.Trim(), this.txtUserID.Text.Trim() + "@163.com");


                SystemUserWrapper clientUser = SystemUserWrapper.GetUserByLoginID(loginID);

                clientUser.UserName = loginID;

                SystemUserWrapper.Update(clientUser);

                SystemRoleWrapper clientRole = SystemRoleWrapper.GetRoleByName("SPDownGroupUser");

                SystemUserWrapper.PatchAssignUserRoles(clientUser, new List <string> {
                    clientRole.RoleID.ToString()
                });

                obj.UserID = clientUser.UserID;

                SPClientGroupWrapper.Save(obj);

                winSPClientGroupAdd.Hide();
            }
            catch (Exception ex)
            {
                Coolite.Ext.Web.ScriptManager.AjaxSuccess      = false;
                Coolite.Ext.Web.ScriptManager.AjaxErrorMessage = "错误信息:" + ex.Message;
            }
        }
        protected void btnSaveSystemUser_Click(object sender, AjaxEventArgs e)
        {
            string loginID = this.txtUserLoginID.Text.Trim();

            if (SystemUserWrapper.GetUserByLoginID(loginID) != null)
            {
                ScriptManager.AjaxSuccess      = false;
                ScriptManager.AjaxErrorMessage = "错误信息: 用户登录ID已经存在!";
                return;
            }


            try
            {
                if (!string.IsNullOrEmpty(this.txtUserEmail.Text.Trim()))
                {
                    Membership.CreateUser(loginID, this.txtUserPassword.Text.Trim(), this.txtUserEmail.Text.Trim());
                }
                else
                {
                    Membership.CreateUser(loginID, this.txtUserPassword.Text.Trim());
                }

                SystemUserWrapper user = SystemUserWrapper.GetUserByLoginID(loginID);

                if (user != null)
                {
                    user.UserType = "SPCOM";
                    SystemUserWrapper.Update(user);
                }

                SystemUserWrapper.PatchAssignUserRoles(user, new List <string>()
                {
                    SystemRoleWrapper.GetRoleByName("SPCOM").RoleID.ToString()
                });


                winSystemUserAdd.Hide();
            }
            catch (Exception ex)
            {
                ScriptManager.AjaxSuccess      = false;
                ScriptManager.AjaxErrorMessage = "错误信息: " + ex.Message;
            }
        }
Esempio n. 3
0
        private int AddClientUser(string loginID)
        {
            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()
            });

            return(clientUser.UserID);
        }
        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;
            }
        }
Esempio n. 5
0
        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;
            }
        }