/// <summary> /// 0 成功修改 1 old密码错误 2 两次密码不对应 3 登陆id 数据库错误 /// </summary> /// <param name="id">id</param> /// <param name="old"></param> /// <param name="new1"></param> /// <param name="new2"></param> /// <returns></returns> public static int ModifyPwd(int id, int idtype, String[] pwd) { //调用 工厂上下文 IDataV operate = FunctionMethod.MTSContext.Context(idtype); if (PasscodeTransfer.PwdIsCompare(operate.GetPwd(id), PasscodeTransfer.PwdEncryption(pwd[0]))) { if (PasscodeTransfer.PwdEncryption(pwd[1]) == PasscodeTransfer.PwdEncryption(pwd[2]))//2 两次密码不对应 { //修改密码 if (0 == operate.SetPwd(id, PasscodeTransfer.PwdEncryption(pwd[2]))) {//数据库错误 return(3); } return(0); } else { return(2); } } else { return(1); } }
/// <summary> /// 登陆判断 /// 返回 0 表明登陆成功 /// 返回 1 表明无此编号 返回 2 表明密码错误 /// </summary> /// <param name="login"></param> /// <returns></returns> public int CheckLoginInfo(String ID, String Pwd) { { DBWebCCEntities db = new DBWebCCEntities(); var mana = from d in db.Arranger_table where d.NumberArranger == ID select d; if (mana.FirstOrDefault() == null) { return(1); } if (!PasscodeTransfer.PwdIsCompare(mana.FirstOrDefault().PasscodeArranger, Pwd)) { return(2); } return(0); } }