Beispiel #1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string loginname = txtloginName.Text.Trim();
            UserInfo userInfo = null;
            string loginpwd = txtloginPwd.Text.Trim();
            string name = txtName.Text.Trim();
            userInfo = new UserInfo();
            userInfo.LoginName = loginname;
            userInfo.LoginPwd = loginpwd;
            userInfo.Name = name;
            userInfo.AllowAddGhost = RadioBtnAllow.Checked;
            userInfo.IsPublicGroup = RadioBtnForbidden.Checked;
            userInfo.IsAllowTesting = cbAllowTesting.Checked;
            userInfo.ParentId = (Session["currentUser"] as UserInfo).Id;
            userInfo.CreditUsed = 0;
            userInfo.CreditAvailable = 0;
            userInfo.ExpiryDate = cbAllowTesting.Checked ? DateTime.Now.AddDays(Convert.ToInt32(ConfigurationManager.AppSettings["TrialDuration"])) : DateTime.Now;

            if (lblPartner1.Text.Contains("ADD"))
            {
                if (PartnerBLL.AddNewPartner_checkLoginName(loginname))
                {
                    Common.yvonYmPrompt.AlertError("This user already exists!", Page);
                    return;
                }
                else
                {
                    if (PartnerBLL.AddNewPartner(userInfo))
                    {
                        // todo: adding user and this (adding package) should be done within 1 transaction!
                        // Set package level, testing users have level 1 for each package, non-testing users have level 0 from each package;
                        int newId = PartnerBLL.getPartnerDetail(loginname).Id;
                        AutoBwsBLL.Credit.CreditManager cm = new AutoBwsBLL.Credit.CreditManager();
                        cm.FreePackage(newId, 1, 1);
                        cm.FreePackage(newId, 2, 1);

                        Common.yvonYmPrompt.AlertSuccess("User account created!", Page, "cleanyvon");
                    }
                    else
                    {
                        Common.yvonYmPrompt.AlertError("Failed to create user account!", Page);
                    }
                }
            }
            else
            {
                if (PartnerBLL.UpdatePartner(userInfo))
                {
                    Common.yvonYmPrompt.AlertSuccess("User account updated!", this.Page, "cleanyvon");
                    HttpContext.Current.Response.Redirect("~/files/PartnerList.aspx");
                }
                else
                {
                    Common.yvonYmPrompt.AlertError("Failed to update user account!", this.Page);
                }
            }
        }
Beispiel #2
0
        //        AutoBwsBLL.Config.ConfigManager cm = new AutoBwsBLL.Config.ConfigManager();
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            if (!IsPostBack)
            {
                Bind();
                //System.Web.HttpServerUtility hs=new HttpServerUtility();
                //Server.MapPath
                //ConfigurationManager.AppSettings["CreditFile"]
            }

            AutoBwsBLL.Credit.CreditManager cmm = new AutoBwsBLL.Credit.CreditManager();
            //   cmm.StopUserHandle += new AutoBwsBLL.Credit.CreditManager.StopUser(cmm_StopUserHandle);
        }