public static void OpenToDoList() { using (DBToDoList.InhToDoListDataContext cdc = new DBToDoList.InhToDoListDataContext()) { string OTP = new RandomCls.RandomAlphanumeric().RandomString(20); DBToDoList.mst_user_otp mdo = cdc.mst_user_otps.Where(x => x.mul_user_login == Program.CurrentUser.mut_username).FirstOrDefault(); if (mdo == null) { mdo = new DBToDoList.mst_user_otp(); mdo.mul_user_login = Program.CurrentUser.mut_username; cdc.mst_user_otps.InsertOnSubmit(mdo); } mdo.mul_otp = OTP; mdo.mul_expire = Program.GetServerDateTime().AddMinutes(10); try { cdc.SubmitChanges(); } catch { } string url = string.Format(PrePareData.StaticDataCls.ToDoListUrl, Program.CurrentUser.mut_username, OTP); Program.OpenLink(url); } }
private void linkApproveToolStripMenuItem_Click(object sender, EventArgs e) { if (Program.CurrentUser.mut_type == 'D') { using (InhCheckupDataContext cdc = new InhCheckupDataContext()) { string urlDoctorApprove = cdc.mst_project_configs.Where(x => x.mpc_code == "urlDoctorApprove").Select(x => x.mpc_value).FirstOrDefault(); string OTP = new RandomCls.RandomAlphanumeric().RandomString(20); mst_user_otp mdo = cdc.mst_user_otps.Where(x => x.mut_id == Program.CurrentUser.mut_id).FirstOrDefault(); if (mdo == null) { mdo = new mst_user_otp(); mdo.mut_id = Program.CurrentUser.mut_id; cdc.mst_user_otps.InsertOnSubmit(mdo); } mdo.mut_otp = OTP; mdo.mut_expire = Program.GetServerDateTime().AddMinutes(10); cdc.SubmitChanges(); string url = string.Format(urlDoctorApprove, Program.CurrentUser.mut_username, OTP); Program.OpenLink(url); } } }