/// <summary> /// 本地版激活 /// </summary> /// <param name="account"></param> /// <param name="regCode"></param> /// <returns></returns> public ReturnBase RegMachine(string machineCode, string regCode) { var result = new ReturnBase(); var rCode = new RegCode(); string condition = "[Code]=@Code and [IsUse]=0 and [CodeType]=0"; rCode = rCode.QueryByCondition(condition, new List <SqlParameter>() { new SqlParameter("@Code", regCode) }); if (rCode == null) { result.IsSuccess = false; result.Message = "激活码不存在或已经被使用"; return(result); } rCode.IsUse = 1; rCode.UseAccountOrMachine = machineCode; rCode.Update(); result.IsSuccess = true; result.Message = $"设备绑定成功"; return(result); }
protected BaseReg(RegCode code, int size) : base(size: size) { _code = code; if (RegisterType == 0) throw new ArgumentException(); }
protected void btnSave_Click(object sender, System.EventArgs e) { bool errored = false; Invitee newInv = new Invitee(); RegCode regCode = new RegCode(); RegCodeRepository regRepos = new RegCodeRepository(); newInv.Salutation = this.txtInvRank.Text; newInv.FirstName = txtFirstName.Text; newInv.LastName = txtLastName.Text; newInv.Address = this.txtAddress.Text; // updatedInv.Clinic = this.txtClinic.Text; newInv.City = this.txtCity.Text; newInv.Province = new Province(); newInv.Province.ID = Int32.Parse(this.ddProvince.SelectedValue); newInv.PostalCode = this.txtPostal.Text; newInv.Phone = this.txtTelephone.Text; // updatedInv.CellPhone = this.txtCellPhone.Text; newInv.Fax = this.txtFax.Text; newInv.Email = this.txtEmail.Text; //newInv.Comments = "Manually Added" + Environment.NewLine + this.txtComments.Text; newInv.Comments = this.txtComments.Text; regCode = regRepos.GetNewCode(); newInv.RegistrationCode = regCode.Code; try { invRepos.AddInvitee(newInv); regRepos.UpdateRegCode(regCode.ID); } catch (Exception exc) { lblMsg.Text = exc.InnerException.Message; errored = true; //throw; } if (!errored) { ScriptManager.RegisterStartupScript(this, GetType(), "", "window.alert('Physician Record updated successfully'); parent.location.reload(true); parent.jQuery.fancybox.close();", true); } //else // ScriptManager.RegisterStartupScript(this, GetType(), "", "window.alert('Physician Record CANNOT be updated, please try again later'); parent.location.reload(true); parent.jQuery.fancybox.close();", true); }
/// <summary> /// 检查本地版设备激活状态 /// </summary> /// <returns></returns> public ReturnBase CheckMachineRegStatus(string machineCode) { var result = new ReturnBase(); var rCode = new RegCode(); string condition = "[UseAccountOrMachine]=@UseAccountOrMachine and [CodeType]=0"; rCode = rCode.QueryByCondition(condition, new List <SqlParameter>() { new SqlParameter("@UseAccountOrMachine", machineCode) }); result.IsSuccess = rCode != null; return(result); }
/// <summary> /// 网络版激活 /// </summary> /// <param name="account"></param> /// <param name="regCode"></param> /// <returns></returns> public ReturnBase RegAccount(string account, string regCode) { var result = new ReturnBase(); var rCode = new RegCode(); string condition = "[Code]=@Code and [IsUse]=0 and [CodeType]=1"; rCode = rCode.QueryByCondition(condition, new List <SqlParameter>() { new SqlParameter("@Code", regCode) }); if (rCode == null) { result.IsSuccess = false; result.Message = "激活码不存在或已经被使用"; return(result); } var user = new User(); condition = "[Account]=@Account"; user = user.QueryByCondition(condition, new List <SqlParameter>() { new SqlParameter("@Account", account) }); if (user != null) { if (user.OutTime > DateTime.Now) { user.OutTime = user.OutTime.AddDays(rCode.Term); } else { user.OutTime = DateTime.Now.AddDays(rCode.Term); } rCode.IsUse = 1; rCode.UseAccountOrMachine = user.Account; user.Update(); rCode.Update(); result.IsSuccess = true; result.Message = $"激活成功,账号使用时间增加{rCode.Term}天"; return(result); } result.IsSuccess = false; result.Message = "用户不存在"; return(result); }
/// <summary> /// 获得注册卡 /// </summary> /// <param name="codeType"></param> /// <param name="time"></param> /// <returns></returns> public string GetRegCode(int codeType, int time) { RegCode regCode = new RegCode(); string condition = "[CodeType]=@CodeType and [Term]=@Term and IsUse=0"; var parameters = new List <SqlParameter>() { new SqlParameter("@CodeType", codeType), new SqlParameter("@Term", time) }; var result = regCode.QueryByCondition(condition, parameters); if (result != null) { return(result.Code); } else { return("未提取到符合条件的激活码"); } }
protected void imgSubmit_clicked(object sender, System.EventArgs e) { bool errored = false; RegCode regCode = new RegCode(); RegCodeRepository regRepos = new RegCodeRepository(); Invitee newInvitee = new Invitee(); try { newInvitee.FirstName = txtFirstName.Text; newInvitee.LastName = txtLastName.Text; newInvitee.PrimaryWorkplace = txtClinic.Text; newInvitee.Address = txtAddress.Text; newInvitee.City = txtCity.Text; newInvitee.ProvinceID = Int32.Parse(ddProvince.SelectedValue.ToString()); newInvitee.PostalCode = txtPostalCode.Text; newInvitee.Phone = txtPhone.Text; newInvitee.Fax = txtFax.Text; newInvitee.OptInEmail = txtEmail.Text; newInvitee.Comments = txtComments.Text; regCode = regRepos.GetNewCode(); newInvitee.RegistrationCode = regCode.Code; invRepos.AddInvitee(newInvitee); regRepos.UpdateRegCode(regCode.ID); } catch (Exception exc) { errored = true; } if (!errored) { ScriptManager.RegisterStartupScript(this, GetType(), "", "window.alert('Physician Record updated successfully'); parent.location.reload(true); parent.jQuery.fancybox.close();", true); } else { ScriptManager.RegisterStartupScript(this, GetType(), "", "window.alert('Physician Record CANNOT be updated, please try again later'); parent.location.reload(true); parent.jQuery.fancybox.close();", true); } }
protected void imgSubmit_clicked(object sender, System.EventArgs e) { if (string.IsNullOrEmpty(this.rdoType.SelectedValue)) { lblTypeReq.Visible = true; return; } bool errored = false; RegCode regCode = new RegCode(); RegCodeRepository regRepos = new RegCodeRepository(); Invitee newInvitee = new Invitee(); try { newInvitee.FirstName = txtFirstName.Text; newInvitee.LastName = txtLastName.Text; newInvitee.PrimaryWorkplace = txtClinic.Text; newInvitee.Address = txtAddress.Text; newInvitee.City = txtCity.Text; newInvitee.ProvinceID = Int32.Parse(ddProvince.SelectedValue.ToString()); newInvitee.PostalCode = txtPostalCode.Text; newInvitee.Phone = txtPhone.Text; newInvitee.Fax = txtFax.Text; newInvitee.OptInEmail = txtEmail.Text; newInvitee.Comments = txtComments.Text; newInvitee.YourFirstName = txtYourFirstName.Text; newInvitee.YourLastName = txtYourLastName.Text; newInvitee.YourEmail = txtYourEmail.Text; if (!string.IsNullOrEmpty(txtBI.Text)) { newInvitee.BITerritoryID = Int32.Parse(this.txtBI.Text); } newInvitee.LillyID = this.txtLilly.Text; if (this.rdoType.SelectedValue == "1") { newInvitee.PhysicianType = Enums.PhysicianType.PCP; } else if (this.rdoType.SelectedValue == "2") { newInvitee.PhysicianType = Enums.PhysicianType.CS; } regCode = regRepos.GetNewCode(); newInvitee.RegistrationCode = regCode.Code; SponserUser user = VistaDM.Admin.Code.UserHelper.GetLoggedInUser(HttpContext.Current.Session); newInvitee.IsAdminApproved = user.IsAdmin; invRepos.AddInvitee(newInvitee); regRepos.UpdateRegCode(regCode.ID); } catch (Exception exc) { errored = true; } if (!errored) { ScriptManager.RegisterStartupScript(this, GetType(), "", "window.alert('Physician Record updated successfully'); parent.location.reload(true); parent.jQuery.fancybox.close();", true); } else { ScriptManager.RegisterStartupScript(this, GetType(), "", "window.alert('Physician Record CANNOT be updated, please try again later'); parent.location.reload(true); parent.jQuery.fancybox.close();", true); } }
public GPReg(RegCode code) : base(code, 1 << (((int)code & (int)RegType.MASK) >> 12)) { }
public X87Reg(RegCode code) : base(code, 10) { }
public bool IsRegCode(RegCode code) { return IsReg && ((BaseReg)this).Code == code; }
public SegmentReg(RegCode code) : base(code, 2) { }
public MMReg(RegCode code) : base(code, 8) { }
public XMMReg(RegCode code) : base(code, 16) { }