public void UpdateApprover(ApproverModel am) { if (am != null && !string.IsNullOrWhiteSpace(am.ApproverID)) { SQLServerDBHelper db = new SQLServerDBHelper("EsignDB"); string UpdateSql = "UPDATE Approver SET SiteID='" + am.SiteId + "',BUID='" + am.BUID + "',ApproverType=N'" + am.ApproverType + "',ApproverEmpNo='" + am.ApproverEmpNo + "',ApproverEmpName=N'" + am.ApproverEmpName + "',SetupEmp='" + Ultils.GetCookie("UserId") + "',SetupTime=getDate() WHERE ApproverID='" + am.ApproverID.Trim() + "'"; if (db.ExcuteNonQuery(UpdateSql)) { Ultils.WriteCookie("Success", LanguageHelper.GetResource("UpdateSuccess")); } else { Ultils.WriteCookie("Error", LanguageHelper.GetResource("UpdateFail")); } } else { Ultils.WriteCookie("Error", LanguageHelper.GetResource("ApproverUpdateEmpty")); } }
public bool insertSchedule(string appNo, string status, int step1) { try { string sqlInsert = @"insert into approvalSchedule(AppNo,statusName,step) values (@AppNo,@statusName,@step)"; SqlParameter[] paRam = new SqlParameter[3]; paRam.SetValue(new SqlParameter("AppNo", appNo), 0); paRam.SetValue(new SqlParameter("statusName", status), 1); paRam.SetValue(new SqlParameter("step", step1), 2); bool ket = sqlHelp.ExcuteNonQuery(sqlInsert); return(ket); } catch (Exception ex) { return(false); } }
public static bool CreateUser(string UserID, string Password, string Username, string Email, string Telephone, string CostNo, string Department, string BUID, string SiteID, string ManagerName, string ManagerEmpNo, string ManagerEmail, string Purpose, string Note, string Permission = "user") { SQLServerDBHelper db = new SQLServerDBHelper("ESign"); string tempSQL = "INSERT INTO Account (UserID,Password,Username,Email,Telephone,CostNo,Department,BUID,SiteID,ManagerName,ManagerEmpNo,ManagerEmail,Purpose,Note,Permission) VALUES (@id,@pw,@un,@em,@te,@cn,@dept,@bu,@site,@mn,@men,@me,@pur,@note,@per)"; SqlParameter[] parameters = new SqlParameter[15]; parameters.SetValue(new SqlParameter("id", UserID), 0); parameters.SetValue(new SqlParameter("pw", Password), 1); parameters.SetValue(new SqlParameter("un", Username), 2); parameters.SetValue(new SqlParameter("em", Email), 3); parameters.SetValue(new SqlParameter("te", Telephone), 4); parameters.SetValue(new SqlParameter("cn", CostNo), 5); parameters.SetValue(new SqlParameter("dept", Department), 6); parameters.SetValue(new SqlParameter("bu", BUID), 7); parameters.SetValue(new SqlParameter("site", SiteID), 8); parameters.SetValue(new SqlParameter("mn", ManagerName), 9); parameters.SetValue(new SqlParameter("men", ManagerEmpNo), 10); parameters.SetValue(new SqlParameter("me", ManagerEmail), 11); parameters.SetValue(new SqlParameter("pur", Purpose), 12); parameters.SetValue(new SqlParameter("note", Note), 13); parameters.SetValue(new SqlParameter("per", Permission), 14); return(db.ExcuteNonQuery(tempSQL, parameters)); }
public bool insertSenmail(string empNo, string orderNo, string conten, string appliCant, string notes) { try { PostmanService.PostmanServiceSoapClient postman = new PostmanService.PostmanServiceSoapClient(); DataTable tableEmp = postman.GetEmpInfomation(empNo); string userName = tableEmp.Rows[0]["USER_NAME"].ToString(); string mailTo = nCode.getMailAccount(empNo); if (mailTo != null || mailTo != "") { mailTo = tableEmp.Rows[0]["NOTES_ID"].ToString(); if (mailTo.Equals("") || mailTo == null) { mailTo = ","; } } Random newRan = new Random(); int num = newRan.Next(1, 1000); string ran = Convert.ToString(num); string id = DateTime.Now.ToString("yyyyMMddHHmmss") + ran; DataTable tableEmp2 = postman.GetEmpInfomation(appliCant); string userName2 = tableEmp2.Rows[0]["USER_NAME"].ToString(); string copyto = ""; string sqlQueryLink = @"select * from link_formSign where linkNameTrim = '" + conten.Trim() + "'"; DataTable tbLink = sqlDBEsign.DoSQLSelect(sqlQueryLink); string conte = conten; string linkForm = ""; if (tbLink.Rows.Count > 0) { linkForm = tbLink.Rows[0]["linkSign"].ToString(); } else { linkForm = "http://10.224.81.136:8686/Employee/ApplicationIT/formSign?appNo="; } string fla = "0"; string mailTitle = userName + " , 您好, 《Esign-system 2.0》" + notes + " ! 單據名稱: " + conte + " , 申請人: " + userName2 + " ,申請單號:" + orderNo; string mailBody1 = "\n《Esign-system 2.0》文件電子簽核申請信息,申請單號: " + orderNo; string mailBody2 = "系統網址(web site): http://10.224.81.136:8686/"; string mailBody3 = "\n單據簽核連接(web site of approve): " + linkForm + orderNo; string mailBody4 = "\n"; string mailBody5 = @"\n基本操作說明(Basic operating instructions): 1.點擊系統網址後會出現登錄畫面(使用域帳號登錄[開機帳號 + 開機密碼]). --enter the login page, key in your computer account / your computer password. 2.進入系統界面後,即可選擇申請單號進行簽核. --login system select apply number to approve. 3.若沒有賬號請先註冊您的賬號,待審核審核通過即可登錄使用. --If you don't have an account, please register your account first, and you can login to use after being approved. 基本操作說明: 1.點擊系統網址後會出現登錄畫面() (1)若沒有手動註冊過,則初始賬號和密碼均為工號,該頁面權限已自動開通,無需聯繫系統管理員 (2)若無法登錄,請注意查看系統提示信息,詳情如下: a)若提示沒有賬號,則請自行註冊(若有[新版]和[舊版],請點擊[舊版]進行註冊),註冊成功后再郵件通知系統管理員去開通權限或註冊時自動選擇相應權限(步驟:點擊[自助選擇權限]--》彈出的頁面中選擇相應權限) b)若提示沒有權限,則請郵件通知系統管理員去開通權限 c)若提示密碼不對,則請重置開機密碼 c)若提示賬號被鎖,則請點擊[忘記密碼] 自行解鎖 2.進入系統界面後﹐即可選擇申請單號. 3.系統管理員聯繫方式在系統登錄頁面,請自行查找(若有[新版]和[舊版],請點擊[舊版]進行查找). "; string mailBody6 = "IT聯絡信息 (Ext:535-27847/27123 Mail:[email protected])"; string mailBody = string.Format(@"{0} {1} {2} {3} {4} {5} {6}", mailBody1.PadLeft(4), mailBody2.PadLeft(4), mailBody3.PadLeft(4), mailBody4.PadLeft(4), mailBody5.PadLeft(4), mailBody6.PadLeft(4), DateTime.Now.ToString().PadLeft(4)); string title2 = mailTitle; string sqlQuery = @"insert into sendm(id,sendto,copyto,title,body,flag) values (@id,@sendto,@copyto,@title,@body,@flag) ;"; SqlParameter[] param = new SqlParameter[6]; param.SetValue(new SqlParameter("id", id), 0); param.SetValue(new SqlParameter("sendto", mailTo), 1); param.SetValue(new SqlParameter("copyto", copyto), 2); param.SetValue(new SqlParameter("title", title2), 3); param.SetValue(new SqlParameter("body", mailBody), 4); param.SetValue(new SqlParameter("flag", fla), 5); bool kr = sqlDB.ExcuteNonQuery(sqlQuery, param); return(kr); } catch { return(false); } }
public ActionResult SetUpSigner(FORM_IT_01Model reqModel, string Approval) { setViewDepartment(); var session = (UserLogin)Session[CommonConstants.USER_SESSION]; var emp = session.UserID.Trim(); if (ModelState.IsValid) { switch (Approval) { case "Next": { if (emp == "V0957033") { if (reqModel.Title2 == "FORM_HR_01" || reqModel.Title2 == "FORM_HR_02") { reqModel.Title1Example = "Tieptheo"; string strQuery = @"select * from Forms where formName = '" + reqModel.Title2.Trim() + "' ;"; DataTable tb = new DataTable(); tb = sqlHelp.DoSQLSelect(strQuery); if (tb.Rows.Count > 0) { int formD = Convert.ToInt32(tb.Rows[0]["FormID"].ToString()); string sqlQuery1 = @"select * from SubmitSign where FormID = '" + formD + "' order by SignNo asc"; DataTable tbSignProcess = new DataTable(); tbSignProcess = sqlHelp.DoSQLSelect(sqlQuery1); string signEm = ""; string SignNa = ""; string statusNa = ""; int step1 = 0; //string agent = ""; List <ApprovalAppModel> listAppro = new List <ApprovalAppModel>(); if (tbSignProcess.Rows.Count > 0) { for (int i = 0; i < tbSignProcess.Rows.Count; i++) { step1 = i; statusNa = tbSignProcess.Rows[i]["SignName"].ToString(); listAppro.Add(new ApprovalAppModel { step = step1, statusName = statusNa, signEmpNo = "", SignName = "" }); } } reqModel.approvalApps = listAppro; reqModel.Title3Example = tb.Rows[0]["FormID"].ToString(); } } } else { } break; } case "Return": { reqModel.Title1Example = "khongthayduoc"; break; } case "submit_ok": { var pSelect = Request.Form["testKQ"].ToString(); string[] signSelect = pSelect.Split(','); signSelect = signSelect.Where(x => !string.IsNullOrEmpty(x)).ToArray(); string strQueryDel = @"delete SubmitSign where FormID='" + reqModel.Title3Example + "';"; sqlHelp.ExcuteNonQuery(strQueryDel); int formS = 32; bool checkFlag = false; for (int i = 0; i < signSelect.Length; i++) { string strInsert = @"insert into SubmitSign(FormID,SignNo,SignName) values ('" + formS + "','" + i + "',N'" + signSelect[i].ToString() + "') ;"; checkFlag = sqlHelp.ExcuteNonQuery(strInsert); if (checkFlag == false) { break; } } if (checkFlag) { reqModel.Title1Example = "thanhcong"; } else { reqModel.Title1Example = "thatbai"; } break; } } } return(View(reqModel)); }