public ActionResult DeleteConfirmed(string id, int?page) { page = ((!page.HasValue || page < 1) ? 1 : page); string qcerno = ""; if (!string.IsNullOrWhiteSpace(Request["qcerno"])) { qcerno = Request["qcerno"].Trim(); ViewBag.qcerno = qcerno; } string cdel = Request["cdel"]; if (string.IsNullOrWhiteSpace(cdel)) { string tgourl = "/certifycheck/List?page=" + page + "&qcerno=" + qcerno + "&qcerno=" + qcerno; return(new ContentResult() { Content = @"<script>alert('請勾選要刪除的資料!!');window.history.go(-1);</script>" }); } else { using (Aitag_DBContext con = new Aitag_DBContext()) { NDcommon dbobj = new NDcommon(); SqlConnection conn1 = dbobj.get_conn("Aitag_DBContext"); string sysnote = ""; string[] condtionArr = cdel.Split(','); int condtionLen = condtionArr.Length; for (int i = 0; i < condtionLen; i++) { string cerno = dbobj.get_dbvalue(conn1, "select cerno from certifycheck where cerno ='" + condtionArr[i].ToString() + "'"); sysnote += "認證申請編號:" + cerno + "<br>"; dbobj.dbexecute("Aitag_DBContext", "DELETE FROM certifycheck where cerno = '" + condtionArr[i].ToString() + "'"); } conn1.Close(); conn1.Dispose(); string sysrealsid = Request["sysrealsid"].ToString(); //系統LOG檔 //================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); string sysflag = "D"; dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //====================================================== string tgourl = "/certifycheck/List?page=" + page + "&qcerno=" + qcerno + "&qcerno=" + qcerno; return(new ContentResult() { Content = @"<script>alert('刪除成功!!');location.href='" + tgourl + "'</script>" }); //return RedirectToAction("List"); } } }
public ActionResult brdel(string id, int?page) { page = ((!page.HasValue || page < 1) ? 1 : page); string cdel = Request["cdel"]; string vcid = Request["vcid"]; string bid = Request["bid"]; if (string.IsNullOrWhiteSpace(cdel)) { return(new ContentResult() { Content = @"<script>alert('請勾選要刪除的資料!!');window.history.go(-1);</script>" }); } else { using (AitagBill_DBContext con = new AitagBill_DBContext()) { NDcommon dbobj = new NDcommon(); SqlConnection conn1 = dbobj.get_conn("AitagBill_DBContext"); string sysnote = ""; string[] condtionArr = cdel.Split(','); int condtionLen = condtionArr.Length; for (int i = 0; i < condtionLen; i++) { //string money1 = dbobj.get_dbvalue(conn1, "select ('專案編號' + vcno + ',from vend_contractdet where vcdid = '" + condtionArr[i].ToString() + "'"); //sysnote += money1 + "<br>"; //刪除明細資料 dbobj.dbexecute("AitagBill_DBContext", "DELETE FROM bonusrate where bid = '" + condtionArr[i].ToString() + "'"); } conn1.Close(); conn1.Dispose(); string sysrealsid = Request["sysrealsid"].ToString(); //系統LOG檔 //================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); string sysflag = "D"; dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //====================================================== string tmpform = ""; tmpform = "<body onload=qfr1.submit();>"; tmpform += "<form name='qfr1' action='/custcontract/brlist' method='post'>"; tmpform += "<input type=hidden name='sysflag' id='sysflag' value='" + sysflag + "'>"; tmpform += "<input type=hidden name='page' id='page' value='" + page + "'>"; tmpform += "<input type=hidden id='vcid' name='vcid' value='" + vcid + "'>"; tmpform += "</form>"; tmpform += "</body>"; return(new ContentResult() { Content = @"<script>alert('刪除成功!!');</script>" + tmpform }); } } }
public ActionResult PriCheckdo() { string bid = Request["bid"]; //權限角色同步 if (Request["fsubmit"].ToString() == "1") { string msid = bid; NDcommon dbobj = new NDcommon(); SqlConnection conn = dbobj.get_conn("Aitag_DBContext"); SqlDataReader dr; SqlCommand sqlsmd = new SqlCommand(); sqlsmd.Connection = conn; string sqlstr = "select * from employee where msid = '" + msid + "'"; //string sqlstr = "select * from Privtb where bid = '" + Request["id"].ToString() + "'"; sqlsmd.CommandText = sqlstr; dr = sqlsmd.ExecuteReader(); while (dr.Read()) { dbobj.dbexecute("Aitag_DBContext", "DELETE FROM Privtb where bid = '" + dr["empid"].ToString() + "'"); dbobj.addPrivtb(msid, dr["empid"].ToString()); } dr.Close(); dr.Dispose(); conn.Close(); conn.Dispose(); return(new ContentResult() { Content = @"<script>alert('完成權限角色同步!!');location.href='/Privrole/PriCheck?msid=" + bid + "&psid=2'</script>" }); } else {//修改權限 string psid = Request["psid"].ToString(); if (Request["privdata"] != null) { NDcommon dbobj = new NDcommon(); dbobj.dbexecute("Aitag_DBContext", "DELETE FROM Privtb where bid = '" + bid + "' and psid = '" + psid + "'"); string privstr = Request["privdata"]; string[] pvarr = privstr.Split(','); //NDcommon dbobj = new NDcommon(); SqlConnection conn = dbobj.get_conn("Aitag_DBContext"); SqlCommand sqlsmd = new SqlCommand(); sqlsmd.Connection = conn; for (int i = 0; i < pvarr.Length; i++) { //string psid = dbobj.get_dbvalue(conn, "select distinct psid from sublevel1 where sid = '" + pvarr[i].ToString().Trim() + "'"); if (pvarr[i].ToString().Trim() != "") { sqlsmd.CommandText = "insert into Privtb(sid,bid,psid,chk,subread,subadd,submod,subdel,Bmodid,Bmoddate) values('" + pvarr[i].ToString().Trim() + "','" + bid + "','" + psid + "','1','1','1','1','1','" + Session["empid"].ToString() + "',getdate())"; sqlsmd.ExecuteNonQuery(); } } conn.Close(); conn.Dispose(); //系統LOG檔 //================================================= // // iMedia.Models.NDcommon dbobj = new iMedia.Models.NDcommon(); string syssubname = "系統管理作業 > 使用者管理作業(權限)"; string sysnote = "帳號:" + bid; string sysflag = "M"; SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //================================================= //var oldPolicyManagement = con.Privtbs.Where(r => r.bid == "adm" && data.PolicyManagement.Contains(r.sid)).ToList(); return(new ContentResult() { Content = @"<script>alert('權限修改成功!!');location.href='/Privrole/PriCheck/?msid=" + bid + "&psid=2'</script>" }); } else { return(new ContentResult() { Content = @"<script>alert('請挑選功能權限!!');location.href='/Privrole/PriCheck/?msid=" + bid + "&psid=2'</script>" }); } //return RedirectToAction("PriCheck"); } }
public ActionResult DeleteConfirmed1(string id, int?page) { page = ((!page.HasValue || page < 1) ? 1 : page); string qsublevelname1 = ""; string uplink = ""; if (!string.IsNullOrWhiteSpace(Request["qsublevelname1"])) { qsublevelname1 = Request["qsublevelname1"].Trim(); ViewBag.qsublevelname1 = qsublevelname1; } if (!string.IsNullOrWhiteSpace(Request["uplink"])) { uplink = Request["uplink"].Trim(); ViewBag.uplink = uplink; } string cdel = Request["cdel"]; if (string.IsNullOrWhiteSpace(cdel)) { return(new ContentResult() { Content = @"<script>alert('請勾選要刪除的資料!!');window.history.go(-1);</script>" }); } else { using (Aitag_DBContext con = new Aitag_DBContext()) { NDcommon dbobj = new NDcommon(); SqlConnection conn1 = dbobj.get_conn("Aitag_DBContext"); string sysnote = ""; string[] condtionArr = cdel.Split(','); int condtionLen = condtionArr.Length; for (int i = 0; i < condtionLen; i++) { string esid = dbobj.get_dbvalue(conn1, "select sid from sublevel1 where sid ='" + condtionArr[i].ToString() + "'"); string esublevelname = dbobj.get_dbvalue(conn1, "select sublevelname from sublevel1 where sid ='" + condtionArr[i].ToString() + "'"); sysnote += "表單代碼:" + esid + ",主目錄名稱:" + esublevelname + "<br>"; dbobj.dbexecute("Aitag_DBContext", "DELETE FROM sublevel1 where sid = '" + condtionArr[i].ToString() + "'"); } conn1.Close(); conn1.Dispose(); string sysrealsid = Request["sysrealsid"].ToString(); //系統LOG檔 //================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); string sysflag = "D"; dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //====================================================== // string tgourl = "/sublevel1/List1?page=" + page + "&qsublevelname1=" + qsublevelname1 + "&uplink=" + uplink; // return new ContentResult() { Content = @"<script>alert('刪除成功!!');location.href='" + tgourl + "'</script>" }; string tmpform = ""; tmpform = "<body onload=qfr1.submit();>"; tmpform += "<form name='qfr1' action='/sublevel1/List1' method='post'>"; tmpform += "<input type=hidden name='sysflag' id='sysflag' value='" + sysflag + "'>"; tmpform += "<input type=hidden name='page' id='page' value='" + page + "'>"; tmpform += "<input type=hidden name='uplink' id='uplink' value='" + uplink + "'>"; tmpform += "<input type=hidden id='qsublevelname1' name='qsublevelname1' value='" + qsublevelname1 + "'>"; tmpform += "</form>"; tmpform += "</body>"; return(new ContentResult() { Content = @"<script>alert('刪除成功!!');</script>" + tmpform }); //return RedirectToAction("List"); } } }
public ActionResult Edit(otworklog chks, string sysflag, int?page, string orderdata, string orderdata1) { ModelState.Clear(); page = ((!page.HasValue || page < 1) ? 1 : page); ViewBag.page = page; if (string.IsNullOrWhiteSpace(orderdata)) { orderdata = "otlogid"; } if (string.IsNullOrWhiteSpace(orderdata1)) { orderdata1 = "desc"; } ViewBag.orderdata = orderdata; ViewBag.orderdata1 = orderdata1; string qotstatus = "", qempname = "", qdptid = "", otlogsdate = "", otlogedate = ""; if (!string.IsNullOrWhiteSpace(Request["qotstatus"])) { qotstatus = Request["qotstatus"].Trim(); ViewBag.qotstatus = qotstatus; } if (!string.IsNullOrWhiteSpace(Request["qempname"])) { qempname = Request["qempname"].Trim(); ViewBag.qempname = qempname; } if (!string.IsNullOrWhiteSpace(Request["qdptid"])) { qdptid = Request["qdptid"].Trim(); ViewBag.qdptid = qdptid; } if (!string.IsNullOrWhiteSpace(Request["otlogsdate"])) { otlogsdate = Request["otlogsdate"].Trim(); ViewBag.otlogsdate = otlogsdate; } if (!string.IsNullOrWhiteSpace(Request["otlogedate"])) { otlogedate = Request["otlogedate"].Trim(); ViewBag.otlogedate = otlogedate; } if (sysflag != "E") { using (Aitag_DBContext con = new Aitag_DBContext()) { var data = con.otworklog.Where(r => r.otlogid == chks.otlogid).FirstOrDefault(); otworklog eotworklogs = con.otworklog.Find(chks.otlogid); if (eotworklogs == null) { return(HttpNotFound()); } return(View(eotworklogs)); } } else { if (!ModelState.IsValid) { return(View(chks)); } else { //string oldotlogid = Request["oldotlogid"]; using (Aitag_DBContext con = new Aitag_DBContext()) { NDcommon dbobj = new NDcommon(); chks.otlogid = int.Parse(Request["otlogid"].Trim()); chks.bmodid = Session["tempid"].ToString(); chks.bmoddate = DateTime.Now; con.Entry(chks).State = EntityState.Modified; //con.SaveChanges(); //系統LOG檔 //================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string sysrealsid = Request["sysrealsid"].ToString(); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); string sysnote = "代碼:" + chks.otlogid + "名稱:" + chks.empname; dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //================================================= string tmpform = ""; tmpform = "<body onload=qfr1.submit();>"; tmpform += "<form name='qfr1' action='/otworklog/List' method='post'>"; tmpform += "<input type=hidden name='sysflag' id='sysflag' value='" + sysflag + "'>"; tmpform += "<input type=hidden name='page' id='page' value='" + page + "'>"; tmpform += "<input type=hidden name='orderdata' id='orderdata' value='" + orderdata + "'>"; tmpform += "<input type=hidden name='orderdata1' id='orderdata1' value='" + orderdata1 + "'>"; tmpform += "<input type=hidden id='qotstatus' name='qotstatus' value='" + qotstatus + "'>"; tmpform += "<input type=hidden id='qempname' name='qempname' value='" + qempname + "'>"; tmpform += "<input type=hidden id='qdptid' name='qdptid' value='" + qdptid + "'>"; tmpform += "<input type=hidden id='otlogsdate' name='otlogsdate' value='" + otlogsdate + "'>"; tmpform += "<input type=hidden id='otlogedate' name='otlogedate' value='" + otlogedate + "'>"; tmpform += "</form>"; tmpform += "</body>"; return(new ContentResult() { Content = @"" + tmpform }); //return RedirectToAction("List"); } } } }
public ActionResult contuploaddel(string id, int?page) { page = ((!page.HasValue || page < 1) ? 1 : page); string vcno = "", billtype = ""; if (!string.IsNullOrWhiteSpace(Request["vcno"])) { vcno = Request["vcno"].Trim(); ViewBag.qsmdate = vcno; } if (!string.IsNullOrWhiteSpace(Request["billtype"])) { billtype = Request["billtype"].Trim(); ViewBag.billtype = billtype; } string cdel = Request["cdel"]; if (string.IsNullOrWhiteSpace(cdel)) { return(new ContentResult() { Content = @"<script>alert('請勾選要刪除的資料!!');window.history.go(-1);</script>" }); } else { using (Aitag_DBContext con = new Aitag_DBContext()) { NDcommon dbobj = new NDcommon(); SqlConnection conn1 = dbobj.get_conn("AitagBill_DBContext"); string sysnote = ""; string[] condtionArr = cdel.Split(','); int condtionLen = condtionArr.Length; string mcid = ""; for (int i = 0; i < condtionLen; i++) { string maincontent1 = dbobj.get_dbvalue(conn1, "select cfilename from erpbilldoc where cupid ='" + condtionArr[i].ToString() + "'"); mcid = dbobj.get_dbvalue(conn1, "select vcno from erpbilldoc where cupid ='" + condtionArr[i].ToString() + "'"); sysnote += "檔案名稱:" + maincontent1 + ",序號:" + condtionArr[i].ToString() + ",單據編號" + mcid + "<br>"; dbobj.dbexecute("AitagBill_DBContext", "DELETE FROM erpbilldoc where cupid = '" + condtionArr[i].ToString() + "'"); } conn1.Close(); conn1.Dispose(); string sysrealsid = Session["realsid"].ToString(); //系統LOG檔 //================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); string sysflag = "D"; dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //====================================================== string tgourl = "/filemain/filemain?vcno=" + vcno + "&billtype=" + billtype + "&sid=" + Session["sid"] + "&realsid=" + Session["realsid"]; return(new ContentResult() { Content = @"<script>alert('刪除成功!!');location.href='" + tgourl + "'</script>" }); //return RedirectToAction("List"); } } }
public ActionResult DeleteConfirmed(string id, int?page, string orderdata, string orderdata1) { page = ((!page.HasValue || page < 1) ? 1 : page); ViewBag.page = page; if (string.IsNullOrWhiteSpace(orderdata)) { orderdata = "mcno"; } if (string.IsNullOrWhiteSpace(orderdata1)) { orderdata1 = "desc"; } ViewBag.orderdata = orderdata; ViewBag.orderdata1 = orderdata1; string qmcno = "", qmctitle = ""; if (!string.IsNullOrWhiteSpace(Request["qmcno"])) { qmcno = Request["qmcno"].Trim(); ViewBag.qmcno = qmcno; } if (!string.IsNullOrWhiteSpace(Request["qitemcode"])) { qmctitle = Request["qmctitle"].Trim(); ViewBag.qmctitle = qmctitle; } string cdel = Request["cdel"]; if (string.IsNullOrWhiteSpace(cdel)) { return(new ContentResult() { Content = @"<script>alert('請勾選要刪除的資料!!');window.history.go(-1);</script>" }); } else { using (AitagBill_DBContext con = new AitagBill_DBContext()) { NDcommon dbobj = new NDcommon(); SqlConnection conn1 = dbobj.get_conn("AitagBill_DBContext"); string sysnote = ""; string[] condtionArr = cdel.Split(','); int condtionLen = condtionArr.Length; for (int i = 0; i < condtionLen; i++) { string ebillsubjects = dbobj.get_dbvalue(conn1, "select mcno from mediaclass where mcno = '" + condtionArr[i].ToString() + "'"); sysnote += "代碼:" + ebillsubjects + "<br>"; dbobj.dbexecute("AitagBill_DBContext", "DELETE FROM mediaclass where mcno = '" + condtionArr[i].ToString() + "'"); } conn1.Close(); conn1.Dispose(); string sysrealsid = Request["sysrealsid"].ToString(); //系統LOG檔 //================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); string sysflag = "D"; dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //====================================================== string tmpform = ""; tmpform = "<body onload=qfr1.submit();>"; tmpform += "<form name='qfr1' action='/mediaclass/List' method='post'>"; tmpform += "<input type=hidden name='sysflag' id='sysflag' value='" + sysflag + "'>"; tmpform += "<input type=hidden name='page' id='page' value='" + page + "'>"; tmpform += "<input type=hidden name='orderdata' id='orderdata' value='" + orderdata + "'>"; tmpform += "<input type=hidden name='orderdata1' id='orderdata1' value='" + orderdata1 + "'>"; tmpform += "<input type=hidden id='qmcno' name='qmcno' value='" + qmcno + "'>"; tmpform += "<input type=hidden id='qmctitle' name='qmctitle' value='" + qmctitle + "'>"; tmpform += "</form>"; tmpform += "</body>"; return(new ContentResult() { Content = @"" + tmpform }); } } }
public ActionResult add(workcard col, string sysflag, int?page, string orderdata, string orderdata1) { ModelState.Clear(); page = ((!page.HasValue || page < 1) ? 1 : page); ViewBag.page = page; if (string.IsNullOrWhiteSpace(orderdata)) { orderdata = " wno"; } if (string.IsNullOrWhiteSpace(orderdata1)) { orderdata1 = " asc"; } ViewBag.orderdata = orderdata; ViewBag.orderdata1 = orderdata1; string qwno = "", qcustno = ""; if (!string.IsNullOrWhiteSpace(Request["qwno"])) { qwno = Request["qwno"].Trim(); ViewBag.qwno = qwno; } if (!string.IsNullOrWhiteSpace(Request["qcustno"])) { qcustno = Request["qcustno"].Trim(); ViewBag.qcustno = qcustno; } NDcommon dbobj = new NDcommon(); if (sysflag != "A") { workcard newcol = new workcard(); return(View(newcol)); } else { if (!ModelState.IsValid) { return(View(col)); } else { SqlConnection conn = dbobj.get_conn("AitagBill_DBContext"); col.wno = dbobj.get_billno(conn, "W", "", col.comid.ToString(), "", col.adddate.ToString()); conn.Close(); conn.Dispose(); col.wstatus = "0"; col.bmodid = Session["tempid"].ToString(); col.bmoddate = DateTime.Now; col.ownman = Session["empid"].ToString(); using (AitagBill_DBContext con = new AitagBill_DBContext()) { con.workcard.Add(col); con.SaveChanges(); } //系統LOG檔 //================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string sysrealsid = Request["sysrealsid"].ToString(); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); string sysnote = "客戶:" + col.custno + "工作卡號:" + col.wno; dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //================================================= string tmpform = ""; tmpform = "<body onload=qfr1.submit();>"; tmpform += "<form name='qfr1' action='/workcard/list' method='post'>"; tmpform += "<input type=hidden name='sysflag' id='sysflag' value='" + sysflag + "'>"; tmpform += "<input type=hidden name='page' id='page' value='" + page + "'>"; tmpform += "<input type=hidden name='orderdata' id='orderdata' value='" + orderdata + "'>"; tmpform += "<input type=hidden name='orderdata1' id='orderdata1' value='" + orderdata1 + "'>"; tmpform += "<input type=hidden id='qwno' name='qwno' value='" + qwno + "'>"; tmpform += "<input type=hidden id='qcustno' name='qcustno' value='" + qcustno + "'>"; tmpform += "</form>"; tmpform += "</body>"; return(new ContentResult() { Content = @"<script>alert('新增成功!!');</script>" + tmpform }); // return RedirectToAction("List"); } } }
public ActionResult DeleteConfirmed(string schid) { if (!string.IsNullOrWhiteSpace(Request["year1"])) { ViewBag.year1 = Request["year1"].ToString(); } else { ViewBag.year1 = ""; } if (!string.IsNullOrWhiteSpace(Request["month1"])) { ViewBag.month1 = Request["month1"].ToString(); } else { ViewBag.month1 = ""; } if (!string.IsNullOrWhiteSpace(Request["qschdate"])) { ViewBag.qschdate = Request["qschdate"].ToString(); } else { ViewBag.qschdate = ""; } string schtype = Request["schtype"].ToString(); ViewBag.schtype = schtype; ViewBag.Mflag = Request["Mflag"].ToString(); string tmptitle = ""; switch (schtype) { case "0": tmptitle = "個人備忘"; break; case "1": tmptitle = "個人行程"; break; case "2": tmptitle = "公司行程"; break; } using (Aitag_DBContext con = new Aitag_DBContext()) { NDcommon dbobj = new NDcommon(); SqlConnection conn1 = dbobj.get_conn("Aitag_DBContext"); string sysnote = ""; string schtitle = dbobj.get_dbvalue(conn1, "select schtitle from schedule where schid =" + schid); sysnote = "類別:" + tmptitle + ",標題:" + schtitle + "<br>"; dbobj.dbexecute("Aitag_DBContext", "DELETE FROM schedule where schid = " + schid); conn1.Close(); conn1.Dispose(); string sysrealsid = Request["sysrealsid"].ToString(); //系統LOG檔 //================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); string sysflag = "D"; dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //====================================================== string tmpform = ""; tmpform = "<body onload='qfr1.submit();'>"; tmpform += "<form name='qfr1' action='/schedule/list' method='post'>"; tmpform += "<input type=hidden name='sysflag' id='sysflag' value='" + sysflag + "'>"; tmpform += "<input type=hidden name='year1' id='year1' value='" + ViewBag.year1 + "'>"; tmpform += "<input type=hidden name='month1' id='month1' value='" + ViewBag.month1 + "'>"; tmpform += "<input type=hidden name='Mflag' id='Mflag' value='" + ViewBag.Mflag + "'>"; tmpform += "<input type=hidden name='qschdate' id='qschdate' value='" + ViewBag.qschdate + "'>"; tmpform += "</form>"; tmpform += "</body>"; return(new ContentResult() { Content = @"<script>alert('刪除成功!!');</script>" + tmpform }); } }
public ActionResult Delete(string id, int?page, string orderdata, string orderdata1) { page = ((!page.HasValue || page < 1) ? 1 : page); ViewBag.page = page; ViewBag.orderdata = orderdata; ViewBag.orderdata1 = orderdata1; string qpdno = "", qallcomid = "", qvcno = "", qvcsdate = "", qvcedate = ""; if (!string.IsNullOrWhiteSpace(Request["qallcomid"])) { qallcomid = Request["qallcomid"].Trim(); ViewBag.qvendno = qallcomid; } if (!string.IsNullOrWhiteSpace(Request["qvcno"])) { qvcno = Request["qvcno"].Trim(); ViewBag.qvcno = qvcno; } if (!string.IsNullOrWhiteSpace(Request["qvcsdate"])) { qvcsdate = Request["qvcsdate"].Trim(); ViewBag.qvcsdate = qvcsdate; } if (!string.IsNullOrWhiteSpace(Request["qvcedate"])) { qvcedate = Request["qvcedate"].Trim(); ViewBag.qvcedate = qvcedate; } if (!string.IsNullOrWhiteSpace(Request["qpdno"])) { qpdno = Request["qpdno"].Trim(); ViewBag.qpdno = qpdno; } string cdel = Request["cdel"]; if (string.IsNullOrWhiteSpace(cdel)) { return(new ContentResult() { Content = @"<script>alert('請勾選要刪除的資料!!');window.history.go(-1);</script>" }); } else { using (AitagBill_DBContext con = new AitagBill_DBContext()) { NDcommon dbobj = new NDcommon(); SqlConnection conn1 = dbobj.get_conn("AitagBill_DBContext"); string sysnote = ""; string[] condtionArr = cdel.Split(','); int condtionLen = condtionArr.Length; for (int i = 0; i < condtionLen; i++) { string vcno = dbobj.get_dbvalue(conn1, "select vcno from vend_contract where vcid='" + condtionArr[i].ToString() + "'"); sysnote += "單號:" + vcno + "<br>"; //刪除憑單 dbobj.dbexecute("AitagBill_DBContext", "DELETE FROM vend_contract where vcid = '" + condtionArr[i].ToString() + "'"); //刪除明細 dbobj.dbexecute("AitagBill_DBContext", "DELETE FROM vend_contractdet where vcid = '" + condtionArr[i].ToString() + "'"); } conn1.Close(); conn1.Dispose(); string sysrealsid = Request["sysrealsid"].ToString(); //系統LOG檔 //================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); string sysflag = "D"; dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //====================================================== string tmpform = ""; tmpform = "<body onload=qfr1.submit();>"; tmpform += "<form name='qfr1' action='/custcontract/list' method='post'>"; tmpform += "<input type=hidden name='sysflag' id='sysflag' value='" + sysflag + "'>"; tmpform += "<input type=hidden name='page' id='page' value='" + page + "'>"; tmpform += "<input type=hidden name='orderdata' id='orderdata' value='" + orderdata + "'>"; tmpform += "<input type=hidden name='orderdata1' id='orderdata1' value='" + orderdata1 + "'>"; // tmpform += "<input type=hidden id='qpdno' name='qpdno' value='" + qpdno + "'>"; tmpform += "<input type=hidden id='qallcomid' name='qallcomid' value='" + qallcomid + "'>"; tmpform += "<input type=hidden id='qvcno' name='qvcno' value='" + qvcno + "'>"; // tmpform += "<input type=hidden id='qpcomment' name='qpcomment' value='" + qpcomment + "'>"; tmpform += "<input type=hidden id='qvcsdate' name='qvcsdate' value='" + qvcsdate + "'>"; tmpform += "<input type=hidden id='qvcedate' name='qvcedate' value='" + qvcedate + "'>"; tmpform += "</form>"; tmpform += "</body>"; return(new ContentResult() { Content = @"<script>alert('刪除成功!!');</script>" + tmpform }); } } }
public ActionResult cardbatch(string sysflag) { ModelState.Clear(); string sid = "", realsid = "", yhid = "", carddate = "", ctype = ""; if (!string.IsNullOrWhiteSpace(Request["sid"])) { sid = Request["sid"].Trim(); ViewBag.sid = sid; } if (!string.IsNullOrWhiteSpace(Request["realsid"])) { realsid = Request["realsid"].Trim(); ViewBag.realsid = realsid; } if (!string.IsNullOrWhiteSpace(Request["yhid"])) { yhid = Request["yhid"].Trim(); ViewBag.yhid = yhid; } if (!string.IsNullOrWhiteSpace(Request["carddate"])) { carddate = Request["carddate"].Trim(); ViewBag.carddate = DateTime.Parse(carddate); } if (!string.IsNullOrWhiteSpace(Request["ctype"])) { ctype = Request["ctype"].Trim(); ViewBag.ctype = ctype; } if (sysflag != "A") { return(View()); } else { if (!ModelState.IsValid) { return(View()); } else { NDcommon dbobj = new NDcommon(); //'取得這類人員的上下班時間 string ytstime = "", ydetime = ""; using (SqlConnection conn = dbobj.get_conn("Aitag_DBContext")) { string sql = "select * from yearholiday where yhid = '" + yhid + "'"; using (SqlCommand cmd = new SqlCommand(sql, conn)) { SqlDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { dr.Read(); ytstime = dbobj.get_dbnull2(dr["ytstime"]); ydetime = dbobj.get_dbnull2(dr["ydetime"]); } dr.Close(); } } using (SqlConnection conn = dbobj.get_conn("Aitag_DBContext")) { string sql = "select * from employee where empstatus in ('1','2') and yhid = '" + yhid + "'"; using (SqlCommand cmd = new SqlCommand(sql, conn)) { SqlDataReader dr = cmd.ExecuteReader(); string clogtime = ""; if (ctype == "1") { clogtime = ytstime; } else { clogtime = ydetime; } var bmoddate = DateTime.Now; while (dr.Read()) { cardreallog col = new cardreallog(); col.empid = dbobj.get_dbnull2(dr["empid"]); col.empname = dbobj.get_dbnull2(dr["empname"]); col.dptid = dbobj.get_dbnull2(dr["empworkdepid"]); col.clogdate = ViewBag.carddate; col.clogtime = clogtime; col.comid = Session["comid"].ToString(); col.bmodid = Session["tempid"].ToString(); col.bmoddate = bmoddate; using (Aitag_DBContext con = new Aitag_DBContext()) { con.cardreallog.Add(col); con.SaveChanges(); } } dr.Close(); } } //系統LOG檔 //================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string sysrealsid = Request["sysrealsid"].ToString(); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); string sysnote = "班別代碼:" + yhid + "<br>產生日期:" + carddate + "的資料"; dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //================================================= string tmpform = ""; tmpform += "<script>"; tmpform += "function SetParentOpener() {"; tmpform += "alert('刷卡資料批次產生成功!!');"; tmpform += "parent.opener.location.href='/cardreallog/List';"; tmpform += "window.close();"; tmpform += "}"; tmpform += "</script>"; tmpform += "<body onload=SetParentOpener();>"; tmpform += "</body>"; return(new ContentResult() { Content = @"" + tmpform }); } } }
public ActionResult DeleteConfirmed(string id, int?page) { page = ((!page.HasValue || page < 1) ? 1 : page); string orderdata = "", orderdata1 = ""; if (!string.IsNullOrWhiteSpace(Request["orderdata"])) { orderdata = Request["orderdata"].Trim(); } if (!string.IsNullOrWhiteSpace(Request["orderdata1"])) { orderdata1 = Request["orderdata1"].Trim(); } string qdptid = "", qempname = "", qclogsdate = "", qclogedate = ""; if (!string.IsNullOrWhiteSpace(Request["qdptid"])) { qdptid = Request["qdptid"].Trim(); ViewBag.qdptid = qdptid; } if (!string.IsNullOrWhiteSpace(Request["qempname"])) { qempname = Request["qempname"].Trim(); ViewBag.qempname = qempname; } if (!string.IsNullOrWhiteSpace(Request["qclogsdate"])) { qclogsdate = Request["qclogsdate"].Trim(); ViewBag.qclogsdate = qclogsdate; } if (!string.IsNullOrWhiteSpace(Request["qclogedate"])) { qclogedate = Request["qclogedate"].Trim(); ViewBag.qclogedate = qclogedate; } string tmpform = ""; tmpform = "<body onload=qfr1.submit();>"; tmpform += "<form name='qfr1' action='/cardreallog/List' method='post'>"; //tmpform += "<input type=hidden name='sysflag' id='sysflag' value='" + sysflag + "'>"; tmpform += "<input type=hidden name='page' id='page' value='" + page + "'>"; tmpform += "<input type=hidden name='orderdata' id='orderdata' value='" + orderdata + "'>"; tmpform += "<input type=hidden name='orderdata1' id='orderdata1' value='" + orderdata1 + "'>"; tmpform += "<input type=hidden id='qdptid' name='qdptid' value='" + qdptid + "'>"; tmpform += "<input type=hidden id='qempname' name='qempname' value='" + qempname + "'>"; tmpform += "<input type=hidden id='qclogsdate' name='qclogsdate' value='" + qclogsdate + "'>"; tmpform += "<input type=hidden id='qclogedate' name='qclogedate' value='" + qclogedate + "'>"; tmpform += "</form>"; tmpform += "</body>"; string cdel = Request["cdel"]; if (string.IsNullOrWhiteSpace(cdel)) { return(new ContentResult() { Content = @"<script>alert('請勾選要刪除的資料!!');</script>" + tmpform }); } else { using (Aitag_DBContext con = new Aitag_DBContext()) { NDcommon dbobj = new NDcommon(); SqlConnection conn1 = dbobj.get_conn("Aitag_DBContext"); string sysnote = ""; string[] condtionArr = cdel.Split(','); int condtionLen = condtionArr.Length; for (int i = 0; i < condtionLen; i++) { string ecardreallogs = dbobj.get_dbvalue(conn1, "select empname from cardreallog where crid ='" + condtionArr[i].ToString() + "'"); sysnote += "代碼名稱:" + ecardreallogs + ",序號:" + condtionArr[i].ToString() + "<br>"; dbobj.dbexecute("Aitag_DBContext", "DELETE FROM cardreallog where crid = '" + condtionArr[i].ToString() + "'"); } conn1.Close(); conn1.Dispose(); string sysrealsid = Request["sysrealsid"].ToString(); //系統LOG檔 //================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); string sysflag = "D"; dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //====================================================== return(new ContentResult() { Content = @"<script>alert('刪除成功!!');</script>" + tmpform }); //return RedirectToAction("List"); } } }
//[HttpGet] //public ActionResult Add() //{ // ViewBag.Ifboss = Session["Ifboss"].ToString(); // ViewBag.crid = Session["crid"].ToString(); // cardreallog col = new cardreallog(); // return View(col); //} //[HttpPost] public ActionResult add(cardreallog col, string sysflag, int?page, string orderdata, string orderdata1) { ModelState.Clear(); page = ((!page.HasValue || page < 1) ? 1 : page); ViewBag.page = page; if (string.IsNullOrWhiteSpace(orderdata)) { orderdata = "crid"; } if (string.IsNullOrWhiteSpace(orderdata1)) { orderdata1 = "desc"; } ViewBag.orderdata = orderdata; ViewBag.orderdata1 = orderdata1; string qdptid = "", qempname = "", qclogsdate = "", qclogedate = ""; if (!string.IsNullOrWhiteSpace(Request["qdptid"])) { qdptid = Request["qdptid"].Trim(); ViewBag.qdptid = qdptid; } if (!string.IsNullOrWhiteSpace(Request["qempname"])) { qempname = Request["qempname"].Trim(); ViewBag.qempname = qempname; } if (!string.IsNullOrWhiteSpace(Request["qclogsdate"])) { qclogsdate = Request["qclogsdate"].Trim(); ViewBag.qclogsdate = qclogsdate; } if (!string.IsNullOrWhiteSpace(Request["qclogedate"])) { qclogedate = Request["qclogedate"].Trim(); ViewBag.qclogedate = qclogedate; } if (sysflag != "A") { cardreallog newcol = new cardreallog(); ViewBag.cloghour = ViewBagcloghour(""); ViewBag.clogmin = ViewBagclogmin(""); return(View(newcol)); } else { if (!ModelState.IsValid) { return(View(col)); } else { NDcommon dbobj = new NDcommon(); SqlConnection conn = dbobj.get_conn("Aitag_DBContext"); SqlDataReader dr; SqlCommand sqlsmd = new SqlCommand(); sqlsmd.Connection = conn; string sqlstr = "select crid from cardreallog where crid = '" + col.crid + "'"; sqlsmd.CommandText = sqlstr; dr = sqlsmd.ExecuteReader(); if (dr.Read()) { ModelState.AddModelError("", "權限代碼重複!"); return(View(col)); } dr.Close(); dr.Dispose(); sqlsmd.Dispose(); conn.Close(); conn.Dispose(); col.clogtime = Request["cloghour"].Trim() + Request["clogmin"].Trim() + "00"; col.comid = Session["comid"].ToString(); col.tmpcardno = Request["cardno"].Trim(); col.tmpdepid = Request["dptidname"].Trim(); col.bmodid = Session["tempid"].ToString(); col.bmoddate = DateTime.Now; using (Aitag_DBContext con = new Aitag_DBContext()) { con.cardreallog.Add(col); try { con.SaveChanges(); } catch (Exception ex) { throw; } //系統LOG檔 //================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string sysrealsid = Request["sysrealsid"].ToString(); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); string sysnote = "申請人:" + col.empname + "<br>刷卡日期:" + col.clogdate + " " + Request["cloghour"].Trim() + Request["clogmin"].Trim() + "的資料"; dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //================================================= } string tmpform = ""; tmpform = "<body onload=qfr1.submit();>"; tmpform += "<form name='qfr1' action='/cardreallog/List' method='post'>"; tmpform += "<input type=hidden name='sysflag' id='sysflag' value='" + sysflag + "'>"; tmpform += "<input type=hidden name='page' id='page' value='" + page + "'>"; tmpform += "<input type=hidden name='orderdata' id='orderdata' value='" + orderdata + "'>"; tmpform += "<input type=hidden name='orderdata1' id='orderdata1' value='" + orderdata1 + "'>"; tmpform += "<input type=hidden id='qdptid' name='qdptid' value='" + qdptid + "'>"; tmpform += "<input type=hidden id='qempname' name='qempname' value='" + qempname + "'>"; tmpform += "<input type=hidden id='qclogsdate' name='qclogsdate' value='" + qclogsdate + "'>"; tmpform += "<input type=hidden id='qclogedate' name='qclogedate' value='" + qclogedate + "'>"; tmpform += "</form>"; tmpform += "</body>"; return(new ContentResult() { Content = @"" + tmpform }); // return RedirectToAction("List"); } } }
public ActionResult Edit(cardreallog chks, string sysflag, int?page, string orderdata, string orderdata1) { ModelState.Clear(); page = ((!page.HasValue || page < 1) ? 1 : page); ViewBag.page = page; if (string.IsNullOrWhiteSpace(orderdata)) { orderdata = "crid"; } if (string.IsNullOrWhiteSpace(orderdata1)) { orderdata1 = "desc"; } ViewBag.orderdata = orderdata; ViewBag.orderdata1 = orderdata1; string qdptid = "", qempname = "", qclogsdate = "", qclogedate = ""; if (!string.IsNullOrWhiteSpace(Request["qdptid"])) { qdptid = Request["qdptid"].Trim(); ViewBag.qdptid = qdptid; } if (!string.IsNullOrWhiteSpace(Request["qempname"])) { qempname = Request["qempname"].Trim(); ViewBag.qempname = qempname; } if (!string.IsNullOrWhiteSpace(Request["qclogsdate"])) { qclogsdate = Request["qclogsdate"].Trim(); ViewBag.qclogsdate = qclogsdate; } if (!string.IsNullOrWhiteSpace(Request["qclogedate"])) { qclogedate = Request["qclogedate"].Trim(); ViewBag.qclogedate = qclogedate; } if (sysflag != "E") { using (Aitag_DBContext con = new Aitag_DBContext()) { var data = con.cardreallog.Where(r => r.crid == chks.crid).FirstOrDefault(); cardreallog ecardreallogs = con.cardreallog.Find(chks.crid); if (ecardreallogs == null) { return(HttpNotFound()); } ViewBag.cloghour = ViewBagcloghour(ecardreallogs.clogtime.Substring(0, 2)); ViewBag.clogmin = ViewBagclogmin(ecardreallogs.clogtime.Substring(2, 2)); return(View(ecardreallogs)); } } else { if (!ModelState.IsValid) { return(View(chks)); } else { //string oldcrid = Request["oldcrid"]; using (Aitag_DBContext con = new Aitag_DBContext()) { NDcommon dbobj = new NDcommon(); chks.clogtime = Request["cloghour"].Trim() + Request["clogmin"].Trim() + "00"; chks.tmpcardno = Request["cardno"].Trim(); chks.tmpdepid = Request["dptidname"].Trim(); chks.bmodid = Session["tempid"].ToString(); chks.bmoddate = DateTime.Now; con.Entry(chks).State = EntityState.Modified; con.SaveChanges(); //系統LOG檔 //================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string sysrealsid = Request["sysrealsid"].ToString(); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); string sysnote = "申請人:" + chks.empname + "<br>刷卡日期:" + chks.clogdate + " " + Request["cloghour"].Trim() + Request["clogmin"].Trim() + "的資料"; dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //================================================= string tmpform = ""; tmpform = "<body onload=qfr1.submit();>"; tmpform += "<form name='qfr1' action='/cardreallog/List' method='post'>"; tmpform += "<input type=hidden name='sysflag' id='sysflag' value='" + sysflag + "'>"; tmpform += "<input type=hidden name='page' id='page' value='" + page + "'>"; tmpform += "<input type=hidden name='orderdata' id='orderdata' value='" + orderdata + "'>"; tmpform += "<input type=hidden name='orderdata1' id='orderdata1' value='" + orderdata1 + "'>"; tmpform += "<input type=hidden id='qdptid' name='qdptid' value='" + qdptid + "'>"; tmpform += "<input type=hidden id='qempname' name='qempname' value='" + qempname + "'>"; tmpform += "<input type=hidden id='qclogsdate' name='qclogsdate' value='" + qclogsdate + "'>"; tmpform += "<input type=hidden id='qclogedate' name='qclogedate' value='" + qclogedate + "'>"; tmpform += "</form>"; tmpform += "</body>"; return(new ContentResult() { Content = @"" + tmpform }); //return RedirectToAction("List"); } } } }
public ActionResult Edit(empfunction chks, string sysflag, int?page, string orderdata, string orderdata1) { ModelState.Clear(); page = ((!page.HasValue || page < 1) ? 1 : page); ViewBag.page = page; if (string.IsNullOrWhiteSpace(orderdata)) { orderdata = "funorder"; } if (string.IsNullOrWhiteSpace(orderdata1)) { orderdata1 = "desc"; } ViewBag.orderdata = orderdata; ViewBag.orderdata1 = orderdata1; string qempdid = "", funid = ""; if (!string.IsNullOrWhiteSpace(Request["qempdid"])) { qempdid = Request["qempdid"].Trim(); ViewBag.qempdid = qempdid; } if (!string.IsNullOrWhiteSpace(Request["funid"])) { funid = Request["funid"].Trim(); ViewBag.funid = funid; } if (sysflag != "E") { using (Aitag_DBContext con = new Aitag_DBContext()) { var data = con.empfunction.Where(r => r.empdid == chks.empdid).FirstOrDefault(); empfunction eempfunctions = con.empfunction.Find(chks.empdid); if (eempfunctions == null) { return(HttpNotFound()); } return(View(eempfunctions)); } } else { if (!ModelState.IsValid) { return(View(chks)); } else { //string empdid = Request["empdid"]; using (Aitag_DBContext con = new Aitag_DBContext()) { NDcommon dbobj = new NDcommon(); chks.empid = "99999999"; chks.bmodid = Session["tempid"].ToString(); chks.bmoddate = DateTime.Now; con.Entry(chks).State = EntityState.Modified; con.SaveChanges(); //系統LOG檔 //================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string sysrealsid = Request["sysrealsid"].ToString(); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); string dbdata = dbobj.get_dbvalue(sysconn, "select chkitem from checkcode where chkclass='08' and chkcode='" + chks.funid + "'"); string sysnote = "共用首頁設定:" + dbdata + "的資料"; dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //================================================= string tmpform = ""; tmpform = "<body onload=qfr1.submit();>"; tmpform += "<form name='qfr1' action='/empfunction/List' method='post'>"; tmpform += "<input type=hidden name='sysflag' id='sysflag' value='" + sysflag + "'>"; tmpform += "<input type=hidden name='page' id='page' value='" + page + "'>"; tmpform += "<input type=hidden name='orderdata' id='orderdata' value='" + orderdata + "'>"; tmpform += "<input type=hidden name='orderdata1' id='orderdata1' value='" + orderdata1 + "'>"; tmpform += "<input type=hidden id='qempdid' name='qempdid' value='" + qempdid + "'>"; tmpform += "<input type=hidden id='funid' name='funid' value='" + funid + "'>"; tmpform += "</form>"; tmpform += "</body>"; return(new ContentResult() { Content = @"" + tmpform }); //return RedirectToAction("List"); } } } }
public ActionResult yeardelConfirmed(string id, int?page, string orderdata, string orderdata1) { page = ((!page.HasValue || page < 1) ? 1 : page); ViewBag.page = page; if (string.IsNullOrWhiteSpace(orderdata)) { orderdata = "yhid"; } if (string.IsNullOrWhiteSpace(orderdata1)) { orderdata1 = "desc"; } ViewBag.orderdata = orderdata; ViewBag.orderdata1 = orderdata1; string qyhid = "", qyhtitle = "", yhid = ""; if (!string.IsNullOrWhiteSpace(Request["qyhid"])) { qyhid = Request["qyhid"].Trim(); ViewBag.qyhid = qyhid; } if (!string.IsNullOrWhiteSpace(Request["qyhtitle"])) { qyhtitle = Request["qyhtitle"].Trim(); ViewBag.qyhtitle = qyhtitle; } if (!string.IsNullOrWhiteSpace(Request["yhid"])) { yhid = Request["yhid"].Trim(); ViewBag.yhid = yhid; } using (Aitag_DBContext con = new Aitag_DBContext()) { NDcommon dbobj = new NDcommon(); SqlConnection conn1 = dbobj.get_conn("Aitag_DBContext"); string sysnote = ""; string yhid1 = dbobj.get_dbvalue(conn1, "select yhid from yearholidaydet where hdid ='" + Request["hdid"].ToString() + "' and comid='" + Session["comid"].ToString() + "'"); string yhsyear = dbobj.get_dbvalue(conn1, "select yhsyear from yearholidaydet where hdid ='" + Request["hdid"].ToString() + "' and comid='" + Session["comid"].ToString() + "'"); sysnote += "年假代碼:" + yhid1 + ",假別代碼:" + yhsyear + "<br>"; dbobj.dbexecute("Aitag_DBContext", "DELETE FROM yearholidaydet where hdid = '" + Request["hdid"].ToString() + "'"); conn1.Close(); conn1.Dispose(); string sysrealsid = Request["sysrealsid"].ToString(); //系統LOG檔 //================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); string sysflag = "D"; dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //====================================================== string tmpform = ""; tmpform = "<body onload=qfr1.submit();>"; tmpform += "<form name='qfr1' action='/yearholiday/Edit' method='post'>"; tmpform += "<input type=hidden name='sysflag' id='sysflag' value='" + sysflag + "'>"; tmpform += "<input type=hidden name='page' id='page' value='" + page + "'>"; tmpform += "<input type=hidden name='orderdata' id='orderdata' value='" + orderdata + "'>"; tmpform += "<input type=hidden name='orderdata1' id='orderdata1' value='" + orderdata1 + "'>"; tmpform += "<input type=hidden id='qyhid' name='qyhid' value='" + qyhid + "'>"; tmpform += "<input type=hidden id='qyhtitle' name='qyhtitle' value='" + qyhtitle + "'>"; tmpform += "<input type=hidden id='yhid' name='yhid' value='" + yhid + "'>"; tmpform += "</form>"; tmpform += "</body>"; return(new ContentResult() { Content = @"<script>alert('刪除成功!!')</script>" + tmpform }); //return RedirectToAction("List"); } }
public ActionResult detedit(yearhddet chks, string sysflag, int?page, string orderdata, string orderdata1) { ModelState.Clear(); page = ((!page.HasValue || page < 1) ? 1 : page); ViewBag.page = page; if (string.IsNullOrWhiteSpace(orderdata)) { orderdata = "hid"; } if (string.IsNullOrWhiteSpace(orderdata1)) { orderdata1 = "desc"; } ViewBag.orderdata = orderdata; ViewBag.orderdata1 = orderdata1; string qyhid = "", qyhtitle = "", yhid = ""; if (!string.IsNullOrWhiteSpace(Request["qyhid"])) { qyhid = Request["qyhid"].Trim(); ViewBag.qyhid = qyhid; } if (!string.IsNullOrWhiteSpace(Request["qyhtitle"])) { qyhtitle = Request["qyhtitle"].Trim(); ViewBag.qyhtitle = qyhtitle; } if (!string.IsNullOrWhiteSpace(Request["yhid"])) { yhid = Request["yhid"].Trim(); ViewBag.yhid = yhid; } if (sysflag != "Q") { using (Aitag_DBContext con = new Aitag_DBContext()) { var data = con.yearhddet.Where(r => r.hid == chks.hid).FirstOrDefault(); yearhddet eyearholidays = con.yearhddet.Find(chks.hid); if (eyearholidays == null) { return(HttpNotFound()); } return(View(eyearholidays)); } } else { if (!ModelState.IsValid) { return(View(chks)); } else { //string oldmsid = Request["oldmsid"]; using (Aitag_DBContext con = new Aitag_DBContext()) { NDcommon dbobj = new NDcommon(); chks.comid = Session["comid"].ToString(); chks.bmodid = Session["tempid"].ToString(); chks.bmoddate = DateTime.Now; con.Entry(chks).State = EntityState.Modified; con.SaveChanges(); //系統LOG檔 //================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string sysrealsid = Request["sysrealsid"].ToString(); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); string sysnote = "年假代碼:" + chks.yhid + "假別代碼:" + chks.hdayid + "發放時數:" + chks.allhour; dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //================================================= string tmpform = ""; tmpform = "<body onload=qfr1.submit();>"; tmpform += "<form name='qfr1' action='/yearholiday/Edit' method='post'>"; tmpform += "<input type=hidden name='sysflag' id='sysflag' value='" + sysflag + "'>"; tmpform += "<input type=hidden name='page' id='page' value='" + page + "'>"; tmpform += "<input type=hidden name='orderdata' id='orderdata' value='" + orderdata + "'>"; tmpform += "<input type=hidden name='orderdata1' id='orderdata1' value='" + orderdata1 + "'>"; tmpform += "<input type=hidden id='qyhid' name='qyhid' value='" + qyhid + "'>"; tmpform += "<input type=hidden id='qyhtitle' name='qyhtitle' value='" + qyhtitle + "'>"; tmpform += "<input type=hidden id='yhid' name='yhid' value='" + yhid + "'>"; tmpform += "</form>"; tmpform += "</body>"; return(new ContentResult() { Content = @"" + tmpform }); //return RedirectToAction("List"); } } } }
public ActionResult Edit(progparam chks, string sysflag, int?page, string orderdata, string orderdata1) { ModelState.Clear(); page = ((!page.HasValue || page < 1) ? 1 : page); ViewBag.page = page; if (string.IsNullOrWhiteSpace(orderdata)) { orderdata = "comid"; } if (string.IsNullOrWhiteSpace(orderdata1)) { orderdata1 = "desc"; } ViewBag.orderdata = orderdata; ViewBag.orderdata1 = orderdata1; string qchkclass = "", qchkitem = ""; string comid = Session["comid"].ToString(); if (sysflag != "E") { using (Aitag_DBContext con = new Aitag_DBContext()) { var data = con.progparam.Where(r => r.comid == comid).FirstOrDefault(); progparam eprogparams = con.progparam.Find(comid); if (eprogparams == null) { eprogparams = new progparam(); // return HttpNotFound(); } //else { return(View(eprogparams)); //} } } else { if (!ModelState.IsValid) { return(View(chks)); } else { //string oldmsid = Request["oldmsid"]; using (Aitag_DBContext con = new Aitag_DBContext()) { NDcommon dbobj = new NDcommon(); chks.bmodid = Session["tempid"].ToString(); chks.bmoddate = DateTime.Now; chks.comid = Session["comid"].ToString(); con.Entry(chks).State = EntityState.Modified; con.SaveChanges(); //系統LOG檔 //================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string sysrealsid = Session["realsid"].ToString(); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); string sysnote = ""; //string sysnote = "後來使用者登入後踢掉前面使用者::" + Request["ifkickuser"].ToString() + "<br>POP3 Server:" + Request["pop3server"].ToString() + "<br>SMTP Server:" + Request["smtpserver"].ToString() + "的資料"; dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //================================================= string tmpform = ""; tmpform = "<body onload=qfr1.submit();>"; tmpform += "<form name='qfr1' action='/progparam/Edit' method='post'>"; tmpform += "<input type=hidden name='sysflag' id='sysflag' value='A'>"; tmpform += "<input type=hidden name='page' id='page' value='" + page + "'>"; tmpform += "<input type=hidden name='orderdata' id='orderdata' value='" + orderdata + "'>"; tmpform += "<input type=hidden name='orderdata1' id='orderdata1' value='" + orderdata1 + "'>"; tmpform += "<input type=hidden name='comid' id='comid' value='" + Session["comid"].ToString() + "'>"; tmpform += "</form>"; tmpform += "</body>"; return(new ContentResult() { Content = @"" + tmpform }); //return RedirectToAction("List"); } } } }
public ActionResult Edit(workcard chks, string sysflag, int?page, string orderdata, string orderdata1) { ModelState.Clear(); page = ((!page.HasValue || page < 1) ? 1 : page); ViewBag.page = page; if (string.IsNullOrWhiteSpace(orderdata)) { orderdata = " wno"; } if (string.IsNullOrWhiteSpace(orderdata1)) { orderdata1 = " asc"; } ViewBag.orderdata = orderdata; ViewBag.orderdata1 = orderdata1; string qwno = "", qcustno = ""; if (!string.IsNullOrWhiteSpace(Request["qwno"])) { qwno = Request["qwno"].Trim(); ViewBag.qwno = qwno; } if (!string.IsNullOrWhiteSpace(Request["qcustno"])) { qcustno = Request["qcustno"].Trim(); ViewBag.qcustno = qcustno; } if (sysflag != "E") { using (AitagBill_DBContext con = new AitagBill_DBContext()) { var data = con.workcard.Where(r => r.wno == chks.wno && r.comid == chks.comid).FirstOrDefault(); workcard eCompanys = con.workcard.Find(chks.wno); if (eCompanys == null) { return(HttpNotFound()); } return(View(eCompanys)); } } else { if (!ModelState.IsValid) { return(View(chks)); } else { NDcommon dbobj = new NDcommon(); string wno = Request["wno"].ToString(); string comid = Request["comid"].ToString(); using (AitagBill_DBContext con = new AitagBill_DBContext()) { workcard modobj = con.workcard.Where(r => r.wno == wno && r.comid == comid).FirstOrDefault(); modobj.projno = Request["projno"]; modobj.custno = Request["custno"]; modobj.wktitle = Request["wktitle"]; modobj.wkbudget = int.Parse(Request["wkbudget"]); modobj.prodno = Request["prodno"]; modobj.pwno = Request["pwno"]; modobj.ifwh = Request["ifwh"]; modobj.whno = Request["whno"]; modobj.prclosedate = DateTime.Parse(Request["prclosedate"].ToString()); modobj.putoffday = int.Parse(Request["putoffday"]); modobj.closedate = DateTime.Parse(Request["closedate"].ToString()); modobj.closeman = Request["closeman"]; modobj.slyear = int.Parse(Request["slyear"]); modobj.slmonth = int.Parse(Request["slmonth"]); modobj.tkyear = int.Parse(Request["tkyear"]); modobj.tkmonth = int.Parse(Request["tkmonth"]); modobj.bmodid = Session["empid"].ToString(); modobj.bmoddate = DateTime.Now; con.Entry(modobj).State = EntityState.Modified; con.SaveChanges(); con.Dispose(); } //系統LOG檔 //================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string sysrealsid = Request["sysrealsid"].ToString(); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); string sysnote = "客戶:" + Request["custno"] + "工作卡號:" + wno; dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //================================================= string tmpform = ""; tmpform = "<body onload=qfr1.submit();>"; tmpform += "<form name='qfr1' action='/workcard/list' method='post'>"; tmpform += "<input type=hidden name='sysflag' id='sysflag' value='" + sysflag + "'>"; tmpform += "<input type=hidden name='page' id='page' value='" + page + "'>"; tmpform += "<input type=hidden name='orderdata' id='orderdata' value='" + orderdata + "'>"; tmpform += "<input type=hidden name='orderdata1' id='orderdata1' value='" + orderdata1 + "'>"; tmpform += "<input type=hidden id='qwno' name='qwno' value='" + qwno + "'>"; tmpform += "<input type=hidden id='qcustno' name='qcustno' value='" + qcustno + "'>"; tmpform += "</form>"; tmpform += "</body>"; return(new ContentResult() { Content = @"<script>alert('修改成功!!');</script>" + tmpform }); // return RedirectToAction("List"); } } }
public ActionResult Edit(holidayschedule chks, string sysflag, int?page, string orderdata, string orderdata1) { ModelState.Clear(); page = ((!page.HasValue || page < 1) ? 1 : page); ViewBag.page = page; if (string.IsNullOrWhiteSpace(orderdata)) { orderdata = "wsid"; } if (string.IsNullOrWhiteSpace(orderdata1)) { orderdata1 = "desc"; } ViewBag.orderdata = orderdata; ViewBag.orderdata1 = orderdata1; string qwstitle = "", qyear = "", qcomid = ""; if (!string.IsNullOrWhiteSpace(Request["qwstitle"])) { qwstitle = Request["qwstitle"].Trim(); ViewBag.qwstitle = qwstitle; } if (!string.IsNullOrWhiteSpace(Request["qyear"])) { qyear = Request["qyear"].Trim(); ViewBag.qyear = qyear; } if (!string.IsNullOrWhiteSpace(Request["qcomid"])) { qcomid = Request["qcomid"].Trim(); ViewBag.qcomid = qcomid; } if (sysflag != "E") { using (Aitag_DBContext con = new Aitag_DBContext()) { var data = con.holidayschedule.Where(r => r.wsid == chks.wsid).FirstOrDefault(); holidayschedule eholidayschedules = con.holidayschedule.Find(chks.wsid); if (eholidayschedules == null) { return(HttpNotFound()); } return(View(eholidayschedules)); } } else { if (!ModelState.IsValid) { return(View(chks)); } else { //string oldmsid = Request["oldmsid"]; using (Aitag_DBContext con = new Aitag_DBContext()) { NDcommon dbobj = new NDcommon(); chks.bmodid = Session["tempid"].ToString(); chks.bmoddate = DateTime.Now; con.Entry(chks).State = EntityState.Modified; con.SaveChanges(); //try //{ // con.SaveChanges(); // con.Dispose(); //} //catch (Exception ex) //{ // throw; //} //系統LOG檔 //================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string sysrealsid = Request["sysrealsid"].ToString(); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); string sysnote = "行事曆標題:" + chks.wstitle + "<br>日期:" + chks.wsdate + "的資料"; dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //================================================= string tmpform = ""; tmpform = "<body onload=qfr1.submit();>"; tmpform += "<form name='qfr1' action='/holidayschedule/List' method='post'>"; tmpform += "<input type=hidden name='sysflag' id='sysflag' value='" + sysflag + "'>"; tmpform += "<input type=hidden name='page' id='page' value='" + page + "'>"; tmpform += "<input type=hidden name='orderdata' id='orderdata' value='" + orderdata + "'>"; tmpform += "<input type=hidden name='orderdata1' id='orderdata1' value='" + orderdata1 + "'>"; tmpform += "<input type=hidden id='qwstitle' name='qchkclass' value='" + qwstitle + "'>"; tmpform += "<input type=hidden id='qyear' name='qchkitem' value='" + qyear + "'>"; tmpform += "<input type=hidden id='qcomid' name='qchkitem' value='" + qcomid + "'>"; tmpform += "</form>"; tmpform += "</body>"; return(new ContentResult() { Content = @"" + tmpform }); //return RedirectToAction("List"); } } } }
public ActionResult Edit(mediaclass chks, string sysflag, int?page, string orderdata, string orderdata1) { ModelState.Clear(); page = ((!page.HasValue || page < 1) ? 1 : page); ViewBag.page = page; if (string.IsNullOrWhiteSpace(orderdata)) { orderdata = "mcno"; } if (string.IsNullOrWhiteSpace(orderdata1)) { orderdata1 = "desc"; } ViewBag.orderdata = orderdata; ViewBag.orderdata1 = orderdata1; string qmcno = "", qmctitle = ""; if (!string.IsNullOrWhiteSpace(Request["qmcno"])) { qmcno = Request["qmcno"].Trim(); ViewBag.qmcno = qmcno; } if (!string.IsNullOrWhiteSpace(Request["qmctitle"])) { qmctitle = Request["qmctitle"].Trim(); ViewBag.qmctitle = qmctitle; } if (sysflag != "E") { using (AitagBill_DBContext con = new AitagBill_DBContext()) { var data = con.mediaclass.Where(r => r.mcno == chks.mcno).FirstOrDefault(); mediaclass ebillsubjects = con.mediaclass.Find(chks.mcno); if (ebillsubjects == null) { return(HttpNotFound()); } return(View(ebillsubjects)); } } else { if (!ModelState.IsValid) { return(View(chks)); } else { using (AitagBill_DBContext con = new AitagBill_DBContext()) { NDcommon dbobj = new NDcommon(); chks.bmodid = Session["tempid"].ToString(); chks.bmoddate = DateTime.Now; con.Entry(chks).State = EntityState.Modified; con.SaveChanges(); //系統LOG檔 //================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string sysrealsid = Request["sysrealsid"].ToString(); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); string sysnote = "編號:" + chks.mcno + "名稱:" + chks.mctitle; dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //================================================= string tmpform = ""; tmpform = "<body onload=qfr1.submit();>"; tmpform += "<form name='qfr1' action='/mediaclass/List' method='post'>"; tmpform += "<input type=hidden name='sysflag' id='sysflag' value='" + sysflag + "'>"; tmpform += "<input type=hidden name='page' id='page' value='" + page + "'>"; tmpform += "<input type=hidden name='orderdata' id='orderdata' value='" + orderdata + "'>"; tmpform += "<input type=hidden name='orderdata1' id='orderdata1' value='" + orderdata1 + "'>"; tmpform += "<input type=hidden id='qmcno' name='qmcno' value='" + qmcno + "'>"; tmpform += "<input type=hidden id='qmctitle' name='qmctitle' value='" + qmctitle + "'>"; tmpform += "</form>"; tmpform += "</body>"; return(new ContentResult() { Content = @"" + tmpform }); //return RedirectToAction("List"); } } } }
public ActionResult Edit(billflow chks, string sysflag, int?page, string orderdata, string orderdata1) { ModelState.Clear(); page = ((!page.HasValue || page < 1) ? 1 : page); ViewBag.page = page; if (string.IsNullOrWhiteSpace(orderdata)) { orderdata = "bid"; } if (string.IsNullOrWhiteSpace(orderdata1)) { orderdata1 = "desc"; } ViewBag.orderdata = orderdata; ViewBag.orderdata1 = orderdata1; string qbillid = "", qcomclass = ""; if (!string.IsNullOrWhiteSpace(Request["qbillid"])) { qbillid = Request["qbillid"].Trim(); ViewBag.qbillid = qbillid; } if (!string.IsNullOrWhiteSpace(Request["qcomclass"])) { qcomclass = Request["qcomclass"].Trim(); ViewBag.qcomclass = qcomclass; } if (sysflag != "E") { using (Aitag_DBContext con = new Aitag_DBContext()) { var data = con.billflow.Where(r => r.bid == chks.bid).FirstOrDefault(); billflow ebillflows = con.billflow.Find(chks.bid); if (ebillflows == null) { return(HttpNotFound()); } return(View(ebillflows)); } } else { if (!ModelState.IsValid) { return(View(chks)); } else { //string oldbillid = Request["oldbillid"]; using (Aitag_DBContext con = new Aitag_DBContext()) { NDcommon dbobj = new NDcommon(); chks.addr = Request["addr"]; chks.billtype = Request["billtype"]; chks.bmodid = Session["tempid"].ToString(); chks.bmoddate = DateTime.Now; con.Entry(chks).State = EntityState.Modified; con.SaveChanges(); //系統LOG檔 //================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string sysrealsid = Request["sysrealsid"].ToString(); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); string tmpbillidname = dbobj.get_dbvalue(sysconn, "select doctitle from docgroup where docid ='" + Request["billid"].Trim() + "' and comid='" + Session["comid"] + "'"); string flowcheck = ""; if (!string.IsNullOrWhiteSpace(Request["flowcheck"].Trim())) { string sqlstr1 = "select * from roleplay where rid in (" + Request["flowcheck"].Trim() + ")"; SqlCommand cmd = new SqlCommand(); cmd.Connection = sysconn; cmd.CommandText = sqlstr1; SqlDataReader dr1 = cmd.ExecuteReader(); while (dr1.Read()) { flowcheck = flowcheck + dr1["roletitle"].ToString() + " → "; } if (flowcheck != "") { flowcheck = flowcheck.Substring(0, flowcheck.Length - 2); } dr1.Close(); dr1.Dispose(); } string sysnote = "呈核單類別:" + tmpbillidname + "<br>呈核人員:" + flowcheck; dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //================================================= string tmpform = ""; tmpform = "<body onload=qfr1.submit();>"; tmpform += "<form name='qfr1' action='/billflow/List' method='post'>"; tmpform += "<input type=hidden name='sysflag' id='sysflag' value='" + sysflag + "'>"; tmpform += "<input type=hidden name='page' id='page' value='" + page + "'>"; tmpform += "<input type=hidden name='orderdata' id='orderdata' value='" + orderdata + "'>"; tmpform += "<input type=hidden name='orderdata1' id='orderdata1' value='" + orderdata1 + "'>"; tmpform += "<input type=hidden id='qbillid' name='qbillid' value='" + qbillid + "'>"; tmpform += "<input type=hidden id='qcomclass' name='qcomclass' value='" + qcomclass + "'>"; tmpform += "</form>"; tmpform += "</body>"; return(new ContentResult() { Content = @"" + tmpform }); //return RedirectToAction("List"); } } } }
public ActionResult Delete(string id, int?page, string orderdata, string orderdata1) { page = ((!page.HasValue || page < 1) ? 1 : page); ViewBag.page = page; ViewBag.orderdata = orderdata; ViewBag.orderdata1 = orderdata1; string qbseason = "", qslyear = "", qslmonth = "", qvtype = "", qvendcomid = ""; if (!string.IsNullOrWhiteSpace(Request["qbseason"])) { qbseason = Request["qbseason"].Trim(); ViewBag.qbseason = qbseason; } if (!string.IsNullOrWhiteSpace(Request["qslyear"])) { qslyear = Request["qslyear"].Trim(); ViewBag.qslyear = qslyear; } if (!string.IsNullOrWhiteSpace(Request["qslmonth"])) { qslmonth = Request["qslmonth"].Trim(); ViewBag.qslmonth = qslmonth; } if (!string.IsNullOrWhiteSpace(Request["qvtype"])) { qvtype = Request["qvtype"].Trim(); ViewBag.qvtype = qvtype; } if (!string.IsNullOrWhiteSpace(Request["qvendcomid"])) { qvendcomid = Request["qvendcomid"].Trim(); ViewBag.qvendcomid = qvendcomid; } string cdel = Request["cdel"]; if (string.IsNullOrWhiteSpace(cdel)) { return(new ContentResult() { Content = @"<script>alert('請勾選要刪除的資料!!');window.history.go(-1);</script>" }); } else { using (AitagBill_DBContext con = new AitagBill_DBContext()) { NDcommon dbobj = new NDcommon(); SqlConnection conn1 = dbobj.get_conn("AitagBill_DBContext"); string sysnote = ""; string[] condtionArr = cdel.Split(','); int condtionLen = condtionArr.Length; for (int i = 0; i < condtionLen; i++) { string vcno = dbobj.get_dbvalue(conn1, "select ('年/月:' + convert(char,slyear)+ '/'+convert(char,slmonth)+ ',廠商:' + vendcomid) as st1 from vend_monthmoney where vsid='" + condtionArr[i].ToString() + "'"); sysnote += vcno + "<br>"; //刪除憑單 dbobj.dbexecute("AitagBill_DBContext", "DELETE FROM vend_monthmoney where vsid = '" + condtionArr[i].ToString() + "'"); } conn1.Close(); conn1.Dispose(); string sysrealsid = Request["sysrealsid"].ToString(); //系統LOG檔 //================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); string sysflag = "D"; dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //====================================================== string tmpform = ""; tmpform = "<body onload=qfr1.submit();>"; tmpform += "<form name='qfr1' action='/vend_monthmoney/list' method='post'>"; tmpform += "<input type=hidden name='sysflag' id='sysflag' value='" + sysflag + "'>"; tmpform += "<input type=hidden name='page' id='page' value='" + page + "'>"; tmpform += "<input type=hidden name='orderdata' id='orderdata' value='" + orderdata + "'>"; tmpform += "<input type=hidden name='orderdata1' id='orderdata1' value='" + orderdata1 + "'>"; tmpform += "<input type=hidden id='qbseason' name='qbseason' value='" + qbseason + "'>"; tmpform += "<input type=hidden id='qslyear' name='qslyear' value='" + qslyear + "'>"; tmpform += "<input type=hidden id='qslmonth' name='qslmonth' value='" + qslmonth + "'>"; tmpform += "<input type=hidden id='qvendcomid' name='qvendcomid' value='" + qvendcomid + "'>"; tmpform += "</form>"; tmpform += "</body>"; return(new ContentResult() { Content = @"<script>alert('刪除成功!!');</script>" + tmpform }); } } }
public ActionResult DeleteConfirmed(string id, int?page) { page = ((!page.HasValue || page < 1) ? 1 : page); string qbillid = "", qcomclass = ""; if (!string.IsNullOrWhiteSpace(Request["qbillid"])) { qbillid = Request["qbillid"].Trim(); ViewBag.qbillid = qbillid; } if (!string.IsNullOrWhiteSpace(Request["qcomclass"])) { qcomclass = Request["qcomclass"].Trim(); ViewBag.qcomclass = qcomclass; } string cdel = Request["cdel"]; if (string.IsNullOrWhiteSpace(cdel)) { return(new ContentResult() { Content = @"<script>alert('請勾選要刪除的資料!!');window.history.go(-1);</script>" }); } else { using (Aitag_DBContext con = new Aitag_DBContext()) { NDcommon dbobj = new NDcommon(); SqlConnection conn1 = dbobj.get_conn("Aitag_DBContext"); string sysnote = ""; string[] condtionArr = cdel.Split(','); int condtionLen = condtionArr.Length; for (int i = 0; i < condtionLen; i++) { string billid = dbobj.get_dbvalue(conn1, "select billid from billflow where bid ='" + condtionArr[i].ToString() + "'"); string flowcheck = dbobj.get_dbvalue(conn1, "select flowcheck from billflow where bid ='" + condtionArr[i].ToString() + "'"); string flowcheck1 = ""; string tmpbillidname = dbobj.get_dbvalue(conn1, "select doctitle from docgroup where docid ='" + billid + "' and comid='" + Session["comid"] + "'"); if (!string.IsNullOrWhiteSpace(flowcheck)) { string sqlstr1 = "select roletitle from roleplay where rid in (" + flowcheck + ")"; SqlCommand cmd = new SqlCommand(); cmd.Connection = conn1; cmd.CommandText = sqlstr1; SqlDataReader dr1 = cmd.ExecuteReader(); while (dr1.Read()) { flowcheck1 = flowcheck1 + dr1["roletitle"].ToString() + " → "; } if (flowcheck1 != "") { flowcheck1 = flowcheck1.Substring(0, flowcheck1.Length - 2); } dr1.Close(); dr1.Dispose(); } sysnote += "呈核單類別:" + tmpbillidname + ",呈核流程:" + flowcheck1 + "<br>"; dbobj.dbexecute("Aitag_DBContext", "DELETE FROM billflow where bid = '" + condtionArr[i].ToString() + "'"); } conn1.Close(); conn1.Dispose(); string sysrealsid = Request["sysrealsid"].ToString(); //系統LOG檔 //================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); string sysflag = "D"; dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //====================================================== string tgourl = "/billflow/List?page=" + page + "&qbillid=" + qbillid + "&qcomclass=" + qcomclass; return(new ContentResult() { Content = @"<script>alert('刪除成功!!');location.href='" + tgourl + "'</script>" }); //return RedirectToAction("List"); } } }
public ActionResult Edit(certifystamp chks, string sysflag, int?page, string orderdata, string orderdata1) { ModelState.Clear(); page = ((!page.HasValue || page < 1) ? 1 : page); ViewBag.page = page; if (string.IsNullOrWhiteSpace(orderdata)) { orderdata = "citemid"; } if (string.IsNullOrWhiteSpace(orderdata1)) { orderdata1 = "desc"; } ViewBag.orderdata = orderdata; ViewBag.orderdata1 = orderdata1; string qwtrack = "", qcitemid = ""; if (!string.IsNullOrWhiteSpace(Request["qwtrack"])) { qwtrack = Request["qwtrack"].Trim(); ViewBag.qwtrack = qwtrack; } if (!string.IsNullOrWhiteSpace(Request["qcitemid"])) { qcitemid = Request["qcitemid"].Trim(); ViewBag.qcitemid = qcitemid; } if (sysflag != "E") { using (Aitag_DBContext con = new Aitag_DBContext()) { var data = con.certifystamp.Where(r => r.citemid == chks.citemid).FirstOrDefault(); certifystamp ecertifystamps = con.certifystamp.Find(chks.citemid); if (ecertifystamps == null) { return(HttpNotFound()); } return(View(ecertifystamps)); } } else { if (!ModelState.IsValid) { return(View(chks)); } else { //string oldmsid = Request["oldmsid"]; using (Aitag_DBContext con = new Aitag_DBContext()) { NDcommon dbobj = new NDcommon(); //chks.comid = Session["comid"].ToString(); chks.bmodid = Session["tempid"].ToString(); chks.bmoddate = DateTime.Now; con.Entry(chks).State = EntityState.Modified; con.SaveChanges(); //系統LOG檔 //================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string sysrealsid = Request["sysrealsid"].ToString(); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); string sysnote = "標章認證字軌:" + chks.wtrack; dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //================================================= string tmpform = ""; tmpform = "<body onload=qfr1.submit();>"; tmpform += "<form name='qfr1' action='/certifystamp/List' method='post'>"; tmpform += "<input type=hidden name='sysflag' id='sysflag' value='" + sysflag + "'>"; tmpform += "<input type=hidden name='page' id='page' value='" + page + "'>"; tmpform += "<input type=hidden name='orderdata' id='orderdata' value='" + orderdata + "'>"; tmpform += "<input type=hidden name='orderdata1' id='orderdata1' value='" + orderdata1 + "'>"; tmpform += "<input type=hidden id='qwtrack' name='qwtrack' value='" + qwtrack + "'>"; tmpform += "<input type=hidden id='qcitemid' name='qcitemid' value='" + qcitemid + "'>"; tmpform += "</form>"; tmpform += "</body>"; return(new ContentResult() { Content = @"" + tmpform }); //return RedirectToAction("List"); } } } }
public ActionResult logcheckEdit(delholidaylog chks, string sysflag, int?page, string orderdata, string orderdata1, HttpPostedFileBase logopic1) { ModelState.Clear(); page = ((!page.HasValue || page < 1) ? 1 : page); ViewBag.page = page; if (string.IsNullOrWhiteSpace(orderdata)) { orderdata = "hdellogid"; } if (string.IsNullOrWhiteSpace(orderdata1)) { orderdata1 = "desc"; } ViewBag.orderdata = orderdata; ViewBag.orderdata1 = orderdata1; string qhlogsdate = "", qhlogedate = ""; if (!string.IsNullOrWhiteSpace(Request["qhlogsdate"])) { qhlogsdate = Request["qhlogsdate"].Trim(); ViewBag.qhlogsdate = qhlogsdate; } if (!string.IsNullOrWhiteSpace(Request["qhlogedate"])) { qhlogedate = Request["qhlogedate"].Trim(); ViewBag.qhlogedate = qhlogedate; } if (sysflag != "E") { using (Aitag_DBContext con = new Aitag_DBContext()) { //var data = con.delholidaylog.Where(r => r.hdellogid == chks.hdellogid).FirstOrDefault(); delholidaylog edelholidaylogs = con.delholidaylog.Find(chks.hdellogid); if (edelholidaylogs == null) { return(HttpNotFound()); } return(View(edelholidaylogs)); } } else { if (!ModelState.IsValid) { return(View(chks)); } else { NDcommon dbobj = new NDcommon(); delholidaylog col = new delholidaylog(); string sysnote = ""; using (Aitag_DBContext con = new Aitag_DBContext()) { col = con.delholidaylog.Find(chks.hdellogid); } string hdellogstatus = ""; if (dbobj.get_dbnull2(Request["hdellogstatus"]) == "1") { string tmprolestampid = col.rolestampid; string rolea_1 = col.rolestampidall; string roleall = rolea_1 + "," + tmprolestampid; //'簽核過角色(多個) string billflowid = col.billflowid.ToString(); //找出下一個角色是誰 string tmprole = dbobj.getnewcheck1("H", tmprolestampid, roleall, "0", "", billflowid); if (tmprole == "'topman'") { tmprole = ""; } if (tmprole == "") { hdellogstatus = "1";// '己簽核 } else { hdellogstatus = "0"; //'找往上呈核長管級數 //'========================== string tmpflowlevel = ""; using (SqlConnection conn = dbobj.get_conn("Aitag_DBContext")) { tmpflowlevel = dbobj.get_dbvalue(conn, "select billflow from flowlevel where bid=" + billflowid); } if (tmpflowlevel == "") { tmpflowlevel = "0"; } string[] tmpa = rolea_1.Split(','); int tmpacount = tmpa.Length; if (int.Parse(tmpflowlevel) == (tmpacount + 1)) { tmprole = ""; hdellogstatus = "1"; // '己簽核 } //'========================== } col.hdellogstatus = hdellogstatus; col.rolestampid = tmprole; col.rolestampidall = roleall; col.empstampidall = col.empstampidall + ",'" + (string)Session["empid"] + "'"; //'所有人員帳號 col.bmodid = (string)Session["empid"]; col.bmoddate = DateTime.Now; col.billtime = col.billtime + "," + DateTime.Now.ToString(); if (tmprole != "") { //寄信 logcheckEditMail(col, tmprole); } else { //(己通過) 寄信 logcheckEditMailPass(col); } } else { col.hdellogstatus = "2"; col.delback = chks.delback; col.bmodid = (string)Session["empid"]; col.bmoddate = DateTime.Now; // col.billtime = col.billtime + "," + DateTime.Now.ToString(); //(己通過) 寄信 logcheckEditMailBack(col); } using (Aitag_DBContext con = new Aitag_DBContext()) { con.Entry(col).State = EntityState.Modified; con.SaveChanges(); } if (hdellogstatus == "1") { //銷假時數補回 delholidayMode(col, hdellogstatus); } //系統LOG檔 if (sysnote.Length > 4000) { sysnote = sysnote.Substring(0, 4000); } ////================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string sysrealsid = Request["sysrealsid"].ToString(); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //================================================= string tmpform = ""; tmpform = "<body onload=qfr1.submit();>"; tmpform += "<form name='qfr1' action='/delholiday/logcheckList' method='post'>"; tmpform += "<input type=hidden name='sysflag' id='sysflag' value='" + sysflag + "'>"; tmpform += "<input type=hidden name='page' id='page' value='" + page + "'>"; tmpform += "<input type=hidden name='orderdata' id='orderdata' value='" + orderdata + "'>"; tmpform += "<input type=hidden name='orderdata1' id='orderdata1' value='" + orderdata1 + "'>"; tmpform += "<input type=hidden id='qhlogsdate' name='qhlogsdate' value='" + qhlogsdate + "'>"; tmpform += "<input type=hidden id='qhlogedate' name='qhlogedate' value='" + qhlogedate + "'>"; tmpform += "</form>"; tmpform += "</body>"; return(new ContentResult() { Content = @"" + tmpform }); } } }
public ActionResult Edit1(sublevel1 chks, string sysflag, int?page, string orderdata, string orderdata1) { ModelState.Clear(); page = ((!page.HasValue || page < 1) ? 1 : page); ViewBag.page = page; if (string.IsNullOrWhiteSpace(orderdata)) { orderdata = "corder"; } if (string.IsNullOrWhiteSpace(orderdata1)) { orderdata1 = "asc"; } ViewBag.orderdata = orderdata; ViewBag.orderdata1 = orderdata1; string qsublevelname1 = ""; string uplink = "0"; if (!string.IsNullOrWhiteSpace(Request["qsublevelname1"])) { qsublevelname1 = Request["qsublevelname1"].Trim(); ViewBag.qsublevelname1 = qsublevelname1; } if (string.IsNullOrWhiteSpace(Request["uplink"])) { uplink = "0"; } else { uplink = Request["uplink"].Trim(); } ViewBag.uplink = uplink; NDcommon dbobj = new NDcommon(); string tmpsid = dbobj.checknumber(Request["tmpsid"]); int tmpsid1 = 0; if (!string.IsNullOrEmpty(tmpsid)) { tmpsid1 = int.Parse(tmpsid); } if (sysflag != "E") { using (Aitag_DBContext con = new Aitag_DBContext()) { var data = con.sublevel1.Where(r => r.sid == tmpsid1).FirstOrDefault(); sublevel1 esublevel1s = con.sublevel1.Find(tmpsid1); if (esublevel1s == null) { return(HttpNotFound()); } return(View(esublevel1s)); } } else { if (!ModelState.IsValid) { return(View(chks)); } else { //string oldmsid = Request["oldmsid"]; using (Aitag_DBContext con = new Aitag_DBContext()) { chks.sid = tmpsid1; chks.lid = "3"; chks.counttype = "00"; chks.uplink = Int32.Parse(uplink); chks.comid = Session["comid"].ToString(); chks.BMODID = Session["tempid"].ToString(); chks.BMODDATE = DateTime.Now; con.Entry(chks).State = EntityState.Modified; con.SaveChanges(); //系統LOG檔 //================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string sysrealsid = Request["sysrealsid"].ToString(); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); string sysnote = "主目錄名稱:" + chks.sublevelname; dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //================================================= string tmpform = ""; tmpform = "<body onload=qfr1.submit();>"; tmpform += "<form name='qfr1' action='/sublevel1/List1' method='post'>"; tmpform += "<input type=hidden name='sysflag' id='sysflag' value='" + sysflag + "'>"; tmpform += "<input type=hidden name='page' id='page' value='" + page + "'>"; tmpform += "<input type=hidden name='orderdata' id='orderdata' value='" + orderdata + "'>"; tmpform += "<input type=hidden name='orderdata1' id='orderdata1' value='" + orderdata1 + "'>"; tmpform += "<input type=hidden name='uplink' id='uplink' value='" + uplink + "'>"; tmpform += "<input type=hidden id='qsublevelname1' name='qsublevelname1' value='" + qsublevelname1 + "'>"; tmpform += "</form>"; tmpform += "</body>"; return(new ContentResult() { Content = @"" + tmpform }); //return RedirectToAction("List"); } } } }
public ActionResult logadd(delholidaylog col, string sysflag, int?page, string orderdata, string orderdata1, HttpPostedFileBase logopic1) { ModelState.Clear(); page = ((!page.HasValue || page < 1) ? 1 : page); ViewBag.page = page; if (string.IsNullOrWhiteSpace(orderdata)) { orderdata = "hdellogid"; } if (string.IsNullOrWhiteSpace(orderdata1)) { orderdata1 = "desc"; } ViewBag.orderdata = orderdata; ViewBag.orderdata1 = orderdata1; if (sysflag != "A") { delholidaylog newcol = new delholidaylog(); return(View(newcol)); } else { if (!ModelState.IsValid) { return(View(col)); } else { NDcommon dbobj = new NDcommon(); //簽核 string tmparolestampid = ""; if (dbobj.get_dbnull2(Request["arolestampid"]) != "") { tmparolestampid = "'" + Request["arolestampid"].ToString() + "'"; } else { tmparolestampid = "'" + Request["arolestampid1"].ToString() + "'"; } string tmpmoney = "0", tmprole = "", tmpbillid = ""; //找出下一個角色是誰 string impallstring = dbobj.getnewcheck1("H", tmparolestampid, tmparolestampid, Request["hloghour"], "", ""); tmprole = impallstring.Split(';')[0].ToString(); tmpbillid = impallstring.Split(';')[1].ToString(); string errmsg = ""; if (tmprole == "") { errmsg = "請先至表單流程設定中設定首長信箱的呈核流程!"; ViewBag.errmsg = "<script>alert('" + errmsg + "');</script>"; return(View(col)); } //簽核 //if ((string)Session["mplayrole"] == "") //{ // errmsg = "您並未設定呈核角色!"; // ViewBag.errmsg = "<script>alert('" + errmsg + "');</script>"; // return View(col); //} //'找單據編號(自動產生編號) string tmpbsno = "select hdno from delholidaylog where year(cdate) = " + DateTime.Now.Year + " and month(cdate) = " + DateTime.Now.Month + " and hdno is not null order by hdno desc"; using (SqlConnection conn = dbobj.get_conn("Aitag_DBContext")) { tmpbsno = dbobj.get_dbvalue(conn, tmpbsno); } if (tmpbsno != "") { tmpbsno = tmpbsno.Substring(tmpbsno.Length - 3, 3); tmpbsno = (int.Parse(tmpbsno) + 1).ToString("000"); } else { tmpbsno = "001"; } string tmpyear = (DateTime.Now.Year - 1911).ToString(); string tmpmonth = DateTime.Now.Month.ToString("00"); tmpbsno = "A" + tmpyear + tmpmonth + tmpbsno; //====== col.hdellogstatus = "0"; col.hdno = tmpbsno; //呈核人員 //====== if (dbobj.get_dbnull2(col.arolestampid) == "") { col.arolestampid = Request["arolestampid1"]; } col.rolestampid = tmprole; //'下個呈核角色 col.rolestampidall = tmparolestampid; //'所有呈核角色 col.empstampidall = "'" + Request["empid"] + "'"; //'所有人員帳號 col.billflowid = int.Parse(tmpbillid); //====== col.comid = (string)Session["comid"]; col.bmodid = (string)Session["empid"]; col.bmoddate = DateTime.Now; col.deldate = DateTime.Now; col.billtime = DateTime.Now.ToString(); using (Aitag_DBContext con = new Aitag_DBContext()) { con.delholidaylog.Add(col); con.SaveChanges(); } // '寄信 //'====================== using (SqlConnection conn = dbobj.get_conn("Aitag_DBContext")) { string fromadd = "", fromaddname = "", mailtitle = "", MailContext = ""; fromadd = dbobj.get_dbvalue(conn, "select enemail from employee where empid='" + Request["empid"] + "'"); fromaddname = dbobj.get_dbvalue(conn, "select empname from employee where empid='" + Request["empid"] + "'"); //'寄送mail給下一個審核角色 #region 寄送mail給下一個審核角 mailtitle = "銷假單資料要求簽核通知"; MailContext = "<HTML><HEAD><meta http-equiv='Content-Type' content='text/html; charset=BIG5'></HEAD><body>"; MailContext = MailContext + "以下為明細資料:<BR>"; MailContext = MailContext + "<table cellpadding=3 cellspacing=0 bordercolorlight=#000000 bordercolordark=ffffff border=1 width=400 bgcolor=ffffff style='FONT-SIZE: 11pt;FONT-FAMILY:Tahoma,Arial'>"; MailContext = MailContext + "<tr><td align=right width=130>申請單號:</td><td>" + tmpbsno + "</td></tr>"; MailContext = MailContext + "<tr><td align=right width=130>請假單號:</td><td>" + col.hsno + "</td></tr>"; MailContext = MailContext + "<tr><td align=right width=130>申請人:</td><td>" + col.empname + "</td></tr>"; MailContext = MailContext + "<tr><td align=right width=130>假別:</td><td>" + Request["hdaytitle"] + "</td></tr>"; string hlogsdate = dbobj.get_dbDate(col.hlogsdate, "yyyy/MM/dd"); string hlogedate = dbobj.get_dbDate(col.hlogedate, "yyyy/MM/dd"); string SEDate = "自{0} ({1})<br>至{2} ({3})"; SEDate = string.Format(SEDate, hlogsdate, col.hlogstime, hlogedate, col.hlogetime); MailContext = MailContext + "<tr><td align=right width=130>日期起訖:</td><td>" + SEDate + "</td></tr>"; if (dbobj.get_dbnull2(col.hlogcomment) != "") { MailContext = MailContext + "<tr><td align=right width=130>備註:</td><td>" + col.hlogcomment.ToString().Trim().Replace(Environment.NewLine, "<br>") + "</td></tr>"; } else { MailContext = MailContext + "<tr><td align=right width=130>備註:</td><td> </td></tr>"; } MailContext = MailContext + "</table>"; MailContext = MailContext + "</body></HTML>"; string tmproleid = tmprole.Replace("'", ""); string sql = "select enemail from viewemprole where rid = '" + tmproleid + "' and empstatus <> '4' and enemail<>''"; using (SqlCommand cmd = new SqlCommand(sql, conn)) { SqlDataReader dr = cmd.ExecuteReader(); string tomail = ""; while (dr.Read()) { tomail += dr["enemail"] + ","; } dbobj.send_mailfile("", tomail, mailtitle, MailContext, null, null); dr.Close(); } #endregion } //系統LOG檔 string sysnote = "申請人:{0}<br>申請單號:{1}的資料"; sysnote = string.Format(sysnote, Request["empid"], tmpbsno); if (sysnote.Length > 4000) { sysnote = sysnote.Substring(0, 4000); } //================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string sysrealsid = Request["sysrealsid"].ToString(); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //================================================= string tmpform = ""; tmpform = "<body onload=qfr1.submit();>"; tmpform += "<form name='qfr1' action='/delholiday/logcheckList' method='post'>"; //tmpform += "<input type=hidden name='sysflag' id='sysflag' value='" + sysflag + "'>"; //tmpform += "<input type=hidden name='page' id='page' value='" + page + "'>"; //tmpform += "<input type=hidden name='orderdata' id='orderdata' value='" + orderdata + "'>"; //tmpform += "<input type=hidden name='orderdata1' id='orderdata1' value='" + orderdata1 + "'>"; tmpform += "</form>"; tmpform += "</body>"; return(new ContentResult() { Content = @"" + tmpform }); } } }
public ActionResult privsublevel1(sublevel1 chks, string sysflag, int?page, string orderdata, string orderdata1) { ModelState.Clear(); NDcommon dbobj = new NDcommon(); string tmpsid = dbobj.checknumber(Request["tmpsid"]); int tmpsid1 = 0; if (!string.IsNullOrEmpty(tmpsid)) { tmpsid1 = int.Parse(tmpsid); } if (sysflag != "E") { using (Aitag_DBContext con = new Aitag_DBContext()) { var data = con.sublevel1.Where(r => r.sid == tmpsid1).FirstOrDefault(); sublevel1 esublevel1s = con.sublevel1.Find(tmpsid1); if (esublevel1s == null) { return(HttpNotFound()); } return(View(esublevel1s)); } } else { if (!ModelState.IsValid) { return(View(chks)); } else { //string oldmsid = Request["oldmsid"]; using (Aitag_DBContext con = new Aitag_DBContext()) { string keysid = tmpsid1.ToString(); string sql = ""; sql = "update sublevel1 set "; sql += " subread = '" + Request["subread"] + "', "; sql += " subadd = '" + Request["subadd"] + "', "; sql += " submod = '" + Request["submod"] + "', "; sql += " subdel = '" + Request["subdel"] + "', "; sql += " BMODID = '" + Session["tempid"].ToString() + "', "; sql += " BMODDATE = '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' "; sql += " where sid = '" + keysid + "' "; dbobj.dbexecute("Aitag_DBContext", sql); //系統LOG檔 //================================================= // SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string sysrealsid = Request["sysrealsid"].ToString(); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2"); string sysnote = "主目錄名稱:" + chks.sublevelname; dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //================================================= string tmpform = ""; tmpform = "<body onload=alert('異動權限修改成功!');window.close();>"; tmpform += "</body>"; return(new ContentResult() { Content = @"" + tmpform }); //return RedirectToAction("List"); } } } }
public ActionResult DeleteConfirmed(string id, int?page) { page = ((!page.HasValue || page < 1) ? 1 : page); string orderdata = "", orderdata1 = ""; if (!string.IsNullOrWhiteSpace(Request["orderdata"])) { orderdata = Request["orderdata"].Trim(); } if (!string.IsNullOrWhiteSpace(Request["orderdata1"])) { orderdata1 = Request["orderdata1"].Trim(); } string qotstatus = "", qempname = "", qdptid = "", otlogsdate = "", otlogedate = ""; if (!string.IsNullOrWhiteSpace(Request["qotstatus"])) { qotstatus = Request["qotstatus"].Trim(); ViewBag.qotstatus = qotstatus; } if (!string.IsNullOrWhiteSpace(Request["qempname"])) { qempname = Request["qempname"].Trim(); ViewBag.qempname = qempname; } if (!string.IsNullOrWhiteSpace(Request["qdptid"])) { qdptid = Request["qdptid"].Trim(); ViewBag.qdptid = qdptid; } if (!string.IsNullOrWhiteSpace(Request["otlogsdate"])) { otlogsdate = Request["otlogsdate"].Trim(); ViewBag.otlogsdate = otlogsdate; } if (!string.IsNullOrWhiteSpace(Request["otlogedate"])) { otlogedate = Request["otlogedate"].Trim(); ViewBag.otlogedate = otlogedate; } string tmpform = ""; tmpform = "<body onload=qfr1.submit();>"; tmpform += "<form name='qfr1' action='/otworklog/List' method='post'>"; tmpform += "<input type=hidden name='page' id='page' value='" + page + "'>"; tmpform += "<input type=hidden name='orderdata' id='orderdata' value='" + orderdata + "'>"; tmpform += "<input type=hidden name='orderdata1' id='orderdata1' value='" + orderdata1 + "'>"; tmpform += "<input type=hidden id='qotstatus' name='qotstatus' value='" + qotstatus + "'>"; tmpform += "<input type=hidden id='qempname' name='qempname' value='" + qempname + "'>"; tmpform += "<input type=hidden id='qdptid' name='qdptid' value='" + qdptid + "'>"; tmpform += "<input type=hidden id='otlogsdate' name='otlogsdate' value='" + otlogsdate + "'>"; tmpform += "<input type=hidden id='otlogedate' name='otlogedate' value='" + otlogedate + "'>"; tmpform += "</form>"; tmpform += "</body>"; string cdel = Request["cdel"]; if (string.IsNullOrWhiteSpace(cdel)) { return(new ContentResult() { Content = @"<script>alert('請勾選要刪除的資料!!');</script>" + tmpform }); } else { Int16 tmpcount = 0; string tmpcomment = ""; string sql = "select * from otworklog"; string sqlwhere = " where otlogid in (" + cdel + ") and comid='" + (string)Session["comid"] + "'"; sql += sqlwhere; NDcommon dbobj = new NDcommon(); using (SqlConnection conn = dbobj.get_conn("Aitag_DBContext")) { using (SqlConnection comconn = dbobj.get_conn("Aitag_DBContext")) { using (SqlCommand cmd = new SqlCommand(sql, conn)) { string xotlogstime = "", xotlogetime = ""; string otcomment = "", mailtitle = "", MailContext = ""; string fromadd = "", fromaddname = "", toadd = ""; string rolestampid = "", sql_m = ""; int bloghour = 0; SqlDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { xotlogstime = "(" + dr["otlogstime"] + ")"; xotlogetime = "(" + dr["otlogetime"] + ")"; #region 寄信(通知給目前簽核角色) if (dbobj.get_dbnull2(dr["otcomment"]) != "") { otcomment = dbobj.get_dbnull2(dr["otcomment"]).Replace(Environment.NewLine, "<br>"); } else { otcomment = " "; } mailtitle = "加班確認單撤回通知"; MailContext = "<HTML><HEAD><meta http-equiv='Content-Type' content='text/html; charset=BIG5'></HEAD><body>"; MailContext = MailContext + "以下為明細資料:<BR>"; MailContext = MailContext + "<table cellpadding=3 cellspacing=0 bordercolorlight=#000000 bordercolordark=ffffff border=1 width=400 bgcolor=ffffff style='FONT-SIZE: 11pt;FONT-FAMILY:Tahoma,Arial'>"; MailContext = MailContext + "<tr><td align=right width=130>申請人:</td><td>" + dbobj.get_dbnull2(dr["empname"]) + "</td></tr>"; MailContext = MailContext + "<tr><td align=right>起迄日期:</td><td>自 " + dbobj.get_dbnull2(dr["otlogsdate"]) + xotlogstime + "<BR>至 " + dbobj.get_dbnull2(dr["otlogedate"]) + xotlogetime + "</td></tr>"; MailContext = MailContext + "<tr><td align=right>共計小時:</td><td>" + dbobj.get_dbnull2(dr["otloghour"]) + "時</td></tr>"; MailContext = MailContext + "<tr><td align=right>事由:</td><td>" + otcomment + "+nbsp;</td></tr>"; MailContext = MailContext + "</table>"; MailContext = MailContext + "</body></HTML>"; //寄件者 fromadd = dbobj.get_dbvalue(comconn, "select enemail from employee where empid='" + (string)Session["empid"] + "'"); fromaddname = (string)Session["empname"]; //'寄給申請人 toadd = dbobj.get_dbvalue(comconn, "select enemail from employee where empid='" + dbobj.get_dbnull2(dr["empid"]) + "'"); if (toadd != "") { //#include file=../inc/mail.asp dbobj.send_mail(mfrom, toadd, mailtitle, MailContext); } //收件者 if (dbobj.get_dbnull2(dr["rolestampid"]) != "") { rolestampid = dbobj.get_dbnull2(dr["rolestampid"]); sql_m = "select enemail from viewemprole where rid in (" + rolestampid + ") and empstatus <> '4' and enemail<>'' and comid='" + (string)Session["comid"] + "'"; using (SqlCommand cmd2 = new SqlCommand(sql, conn)) { SqlDataReader dr2 = cmd2.ExecuteReader(); while (dr.Read()) { toadd = dbobj.get_dbnull2(dr2["enemail"]); //#include file=../inc/mail.asp dbobj.send_mail(mfrom, toadd, mailtitle, MailContext); } dr.Close(); } } #endregion sql = "UPDATE otworklog SET otstatus = 'D'"; sql += sqlwhere; sql += ";delete from resthourlog"; sql += sqlwhere; dbobj.dbexecute("Aitag_DBContext", sql); tmpcount++; tmpcomment += "姓名:" + dbobj.get_dbnull2(dr["empname"]) + "申請單號:" + dbobj.get_dbnull2(dr["osno"]) + ","; } tmpcomment = tmpcomment.Substring(0, tmpcomment.Length - 1); } //系統LOG檔 string sysnote = tmpcomment + "的資料" + tmpcount + "筆"; if (sysnote.Length > 4000) { sysnote = sysnote.Substring(0, 4000); } //================================================= // string sysrealsid = Request["sysrealsid"].ToString(); SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); string syssubname = dbobj.get_sysmenuname(sysconn, sysrealsid, "2") + "(撤回)"; string sysflag = "D"; dbobj.systemlog(sysconn, syssubname, sysnote, Session["tempid"].ToString(), Session["sldate"].ToString(), Session["sfip"].ToString(), sysflag); sysconn.Close(); sysconn.Dispose(); //====================================================== dr.Close(); } } } return(new ContentResult() { Content = @"<script>alert('刪除成功!!');</script>" + tmpform }); } }