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 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"); } } }
private void getSUMhour(string sqlstr, string sqlstr_1) { NDcommon dbobj = new NDcommon(); using (SqlConnection comconn = dbobj.get_conn("Aitag_DBContext")) { ViewBag.otloghour = dbobj.get_dbvalue(comconn, sqlstr_1); using (SqlConnection conn = dbobj.get_conn("Aitag_DBContext")) { string txtosno = "", sqlstr_2 = ""; using (SqlCommand cmd = new SqlCommand(sqlstr, conn)) { SqlDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { txtosno += "'" + dbobj.get_dbnull2(dr["osno"]) + "',"; } sqlstr_2 = "select isnull(sum(resthour),0) as resthour,isnull(sum(moneyhour),0) as moneyhour from resthourlog where osno in (" + txtosno.Substring(0, txtosno.Length - 1) + ") and comid='" + (string)Session["comid"] + "'"; } else { sqlstr_2 = "select isnull(sum(resthour),0) as resthour,isnull(sum(moneyhour),0) as moneyhour from resthourlog where 1<>1"; } dr.Close(); } using (SqlCommand cmd = new SqlCommand(sqlstr_2, conn)) { SqlDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { dr.Read(); ViewBag.sumresthour = dbobj.get_dbnull2(dr["resthour"]); ViewBag.summoneyhour = dbobj.get_dbnull2(dr["moneyhour"]); } else { ViewBag.sumresthour = "0"; ViewBag.summoneyhour = "0"; } } } } }
private void logcheckEditMail(delholidaylog col, string tmprole) { NDcommon dbobj = new NDcommon(); #region 寄給下一個承辦人 string mailtitle = "", MailContext = ""; mailtitle = "【" + col.empname + "】出差單資料要求審核通知"; 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>" + 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>"; MailContext = MailContext + "<tr><td align=right width=130>共計時數:</td><td>" + col.hloghour + "</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>"; using (SqlConnection conn = dbobj.get_conn("Aitag_DBContext")) { tmprole = tmprole.Replace("'", ""); string sql = "select enemail from viewemprole where rid = '" + tmprole + "' 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 }
public ActionResult List1(int?page, string orderdata, string orderdata1) { ViewBag.uplink = Int32.Parse(Request["uplink"]); page = ((!page.HasValue || page < 1) ? 1 : page); ViewBag.page = page; if (string.IsNullOrWhiteSpace(orderdata)) { orderdata = "corder"; } ViewBag.orderdata = orderdata; ViewBag.orderdata1 = orderdata1; string qsublevelname1 = ""; if (!string.IsNullOrWhiteSpace(Request["qsublevelname1"])) { qsublevelname1 = Request["qsublevelname1"].Trim(); ViewBag.qsublevelname1 = qsublevelname1; } IPagedList <sublevel1> result; using (Aitag_DBContext con = new Aitag_DBContext()) { NDcommon dbobj = new NDcommon(); SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); ViewBag.uplinkname = dbobj.get_dbvalue(sysconn, "select sublevelname from sublevel1 where sid = '" + Request["uplink"] + "'"); sysconn.Close(); sysconn.Dispose(); string sqlstr = "select * from sublevel1 where lid = '3' and uplink = '" + Request["uplink"] + "' and "; if (qsublevelname1 != "") { sqlstr += " sublevelname like '%" + qsublevelname1 + "%' and"; } sqlstr = sqlstr.Substring(0, sqlstr.Length - 5); sqlstr += " order by " + orderdata + " " + orderdata1; var query = con.sublevel1.SqlQuery(sqlstr).AsQueryable(); result = query.ToPagedList <sublevel1>(page.Value - 1, (int)Session["pagesize"]); } return(View(result)); }
private void logcheckEditMailBack(delholidaylog col) { NDcommon dbobj = new NDcommon(); #region 寄送mail給申請人 using (SqlConnection conn = dbobj.get_conn("Aitag_DBContext")) { string fromadd = "", fromaddname = "", toadd = ""; 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"] + "'"); toadd = dbobj.get_dbvalue(conn, "select enemail from employee where empid='" + col.empid + "'"); string mailtitle = "", MailContext = ""; 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>" + 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>"; MailContext = MailContext + "<tr><td align=right width=130>共計時數:</td><td>" + col.hloghour + "</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>"; dbobj.send_mailfile("", toadd, mailtitle, MailContext, null, null); } #endregion }
public ActionResult ajaxdropbox() { string sqldata = Request["sqldata"].ToString(); string valname = Request["valname"].ToString(); string showname = Request["showname"].ToString(); string ajaxdiv = Request["ajaxdiv"].ToString(); NDcommon dbobj = new NDcommon(); SqlConnection tmpconn = dbobj.get_conn("AitagBill_DBContext"); // tmpconn.Open(); SqlCommand cmd = new SqlCommand(); cmd.Connection = tmpconn; cmd.CommandText += sqldata; SqlDataReader dr = cmd.ExecuteReader(); string mcontent = "<table border=0 cellpadding=5 class=divdd width=90% id=mtb>"; // mcontent = mcontent + "<tr><td>ID</td><td>媒體名稱</td></tr>"; int j = 1; while (dr.Read()) { if (j == 1) { mcontent = mcontent + "<tr bgcolor='#ddeeff' style='cursor:pointer' id='idarray" + valname + j + "' name='" + dr[0].ToString().Trim() + "," + dr[1].ToString().Trim().Replace("\r", "") + "' onclick=\"$('#" + valname + "').val('" + dr[0].ToString().Trim() + "');$('#" + showname + "').val('" + dr[1].ToString().Trim().Replace("\r", "") + "');$('#" + ajaxdiv + "').css('display','none');\"><td>" + dr[0].ToString().Trim() + "</td><td>" + dr[1].ToString().Trim().Replace("\r", "") + "</td></tr>"; } else { mcontent = mcontent + "<tr bgcolor='#ffffff' style='cursor:pointer' id='idarray" + valname + j + "' name='" + dr[0].ToString().Trim() + "," + dr[1].ToString().Trim().Replace("\r", "") + "' onclick=\"$('#" + valname + "').val('" + dr[0].ToString().Trim() + "');$('#" + showname + "').val('" + dr[1].ToString().Trim().Replace("\r", "") + "');$('#" + ajaxdiv + "').css('display','none');\"><td>" + dr[0].ToString().Trim() + "</td><td>" + dr[1].ToString().Trim().Replace("\r", "") + "</td></tr>"; } //mcontent = mcontent + "<li>" + dr["mdno"].ToString().Trim() + "-" + dr["mdtitle"].ToString().Trim() + "</li>"; j++; } mcontent += "</table>"; ViewBag.mcontent = mcontent; dr.Close(); dr.Dispose(); cmd = null; tmpconn.Close(); tmpconn.Dispose(); return(View()); }
public ActionResult subreadwritelist(int?page, string orderdata, string orderdata1) { page = ((!page.HasValue || page < 1) ? 1 : page); ViewBag.page = page; if (string.IsNullOrWhiteSpace(orderdata)) { orderdata = "srwid"; } ViewBag.orderdata = orderdata; ViewBag.orderdata1 = orderdata1; string qsublevelname1 = "", tmpsid = ""; if (!string.IsNullOrWhiteSpace(Request["qsublevelname1"])) { qsublevelname1 = Request["qsublevelname1"].Trim(); ViewBag.qsublevelname1 = qsublevelname1; } tmpsid = Request["tmpsid"]; IPagedList <subreadwrite> result; using (Aitag_DBContext con = new Aitag_DBContext()) { NDcommon dbobj = new NDcommon(); SqlConnection sysconn = dbobj.get_conn("Aitag_DBContext"); ViewBag.uplinkname = dbobj.get_dbvalue(sysconn, "select sublevelname from sublevel1 where sid = '" + tmpsid + "'"); sysconn.Close(); sysconn.Dispose(); string sqlstr = "select * from subreadwrite where sid = '" + tmpsid + "' and "; sqlstr = sqlstr.Substring(0, sqlstr.Length - 5); sqlstr += " order by srwid"; var query = con.subreadwrite.SqlQuery(sqlstr).AsQueryable(); result = query.ToPagedList <subreadwrite>(page.Value - 1, (int)Session["pagesize"]); } return(View(result)); }
public ActionResult PostCode() { NDcommon dbobj = new NDcommon(); SqlConnection tmpconn = dbobj.get_conn("Aitag_DBContext"); // tmpconn.Open(); SqlCommand cmd = new SqlCommand(); cmd.Connection = tmpconn; //抓出郵區資料 cmd.CommandText = "select * from CodeMap where SubCode = '" + Request["Code"] + "' order by weight"; SqlDataReader dr = cmd.ExecuteReader(); string mcontent = ""; while (dr.Read()) { if (Request["Code1"] != null) { if (Request["Code1"].ToString() == dr["CodeMapId"].ToString()) { mcontent = mcontent + "<option value='" + dr["CodeMapId"].ToString() + "' selected>" + dr["Description"].ToString() + "</option>"; } else { mcontent = mcontent + "<option value='" + dr["CodeMapId"].ToString() + "'>" + dr["Description"].ToString() + "</option>"; } } else { mcontent = mcontent + "<option value='" + dr["CodeMapId"].ToString() + "'>" + dr["Description"].ToString() + "</option>"; } } ViewBag.mcontent = mcontent; dr.Close(); dr.Dispose(); cmd = null; tmpconn.Close(); tmpconn.Dispose(); return(View()); }
public ActionResult getdpt() { NDcommon dbobj = new NDcommon(); SqlConnection tmpconn = dbobj.get_conn("Aitag_DBContext"); // tmpconn.Open(); SqlCommand cmd = new SqlCommand(); cmd.Connection = tmpconn; //抓出郵區資料 cmd.CommandText = "select * from department where comid = '" + Request["comid"] + "' order by dptid"; SqlDataReader dr = cmd.ExecuteReader(); string mcontent = ""; while (dr.Read()) { if (Request["dptval"] != null) { if (Request["dptval"].ToString() == dr["dptid"].ToString()) { mcontent = mcontent + "<option value='" + dr["dptid"].ToString() + "' selected>" + dr["dpttitle"].ToString() + "</option>"; } else { mcontent = mcontent + "<option value='" + dr["dptid"].ToString() + "'>" + dr["dpttitle"].ToString() + "</option>"; } } else { mcontent = mcontent + "<option value='" + dr["dptid"].ToString() + "'>" + dr["dpttitle"].ToString() + "</option>"; } } ViewBag.mcontent = mcontent; dr.Close(); dr.Dispose(); cmd = null; tmpconn.Close(); tmpconn.Dispose(); return(View()); }
public ActionResult otworklogrpt(int?page, string orderdata, string orderdata1) { page = ((!page.HasValue || page < 1) ? 1 : page); ViewBag.page = page; if (string.IsNullOrWhiteSpace(orderdata)) { orderdata = "otlogsdate"; } 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; } else { qotstatus = "1"; 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; } otlogsdate = NullStDate(Request["otlogsdate"]); ViewBag.otlogsdate = otlogsdate; otlogedate = NullTeDate(Request["otlogedate"]); ViewBag.otlogedate = otlogedate; //NullStDate 跟 NullTeDate 會判斷格式,有錯誤就 修改全域的DateEx if (DateEx != "") { ViewBag.DateEx = @"<script>alert(""" + DateEx + @""");</script>"; } NDcommon dbobj = new NDcommon(); string Excel = "", Excel2 = ""; string sqlstr = "", sqlstr_1 = ""; using (Aitag_DBContext con = new Aitag_DBContext()) { string viewid = ""; string[] mpriv = (string[])Session["priv"]; //viewid = get_viewpriv(int.Parse(funcpriv(2)), int.Parse(mpriv(realsid, 2))); string tmpall = ""; //tmpall = dbobj.get_allempid((string)Session["rid"]); tmpall = "%"; if (tmpall == "%") { sqlstr = "SELECT * FROM otworklog where comid='" + (string)Session["comid"] + "' and"; sqlstr_1 = "SELECT isnull(sum(otloghour),0) as otloghour FROM otworklog where comid='" + (string)Session["comid"] + "' and"; } else { sqlstr = "SELECT * FROM otworklog where empid in(" + tmpall + ") and comid='" + (string)Session["comid"] + "' and"; sqlstr_1 = "SELECT isnull(sum(otloghour),0) as otloghour FROM otworklog where empid in(" + tmpall + ") and comid='" + (string)Session["comid"] + "' and"; } if (qotstatus != "all") { string sql_otstatus = " otstatus like '" + qotstatus + "' and"; sqlstr = sqlstr + sql_otstatus; sqlstr_1 = sqlstr_1 + sql_otstatus; } if (otlogsdate != "" && otlogedate != "") { string sql_date = " (( '" + otlogsdate + "' <= otlogsdate and otlogsdate <= '" + otlogedate + "' ) or " + "( '" + otlogsdate + "' <= otlogedate and otlogedate <= '" + otlogedate + "' )) and"; sqlstr = sqlstr + sql_date; sqlstr_1 = sqlstr_1 + sql_date; } if (qempname != "") { string sql_empname = " empname like N'%" + qempname + "%' and"; sqlstr = sqlstr + sql_empname; sqlstr_1 = sqlstr_1 + sql_empname; } if (qdptid != "") { string sql_dptid = " dptid='" + qdptid + "' and"; sqlstr = sqlstr + sql_dptid; sqlstr_1 = sqlstr_1 + sql_dptid; } sqlstr = sqlstr.Substring(0, sqlstr.Length - 5); sqlstr_1 = sqlstr_1.Substring(0, sqlstr_1.Length - 5); getSUMhour(sqlstr, sqlstr_1); sqlstr += " order by " + orderdata + " " + orderdata1; } #region 組 Excel 格式 Excel += "<HTML>"; Excel += "<HEAD>"; Excel += @"<meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8"">"; Excel += "</HEAD>"; Excel += "<body>"; Excel += "<table border=1 cellpadding=0 cellspacing=0 bordercolor=#000000 bordercolordark=#ffffff width=900 >"; Excel += "<tr align=center>"; Excel += @"<td colspan=""9"" style=""font-size:14pt"">加班明細表"; Excel += "</td>"; Excel += "</tr>"; Excel += "<tr align=center>"; int count = 8; Excel += "<td colspan='" + count + "' ></td><td>列印日期:" + DateTime.Now.ToString("yyyy/MM/dd") + "</td>"; Excel += "</tr>"; Excel += "<tr align=center>"; Excel += "<td>狀態</td>"; Excel += "<td>核銷</td>"; Excel += "<td>員工編號</td>"; Excel += "<td>姓名</td>"; Excel += "<td>部門</td>"; Excel += "<td>加班起迄日期</td>"; Excel += "<td>加班時數</td>"; Excel += "<td>補休時數</td>"; Excel += "<td>請款時數</td>"; Excel += "</tr>"; using (SqlConnection conn = dbobj.get_conn("Aitag_DBContext")) { using (SqlCommand cmd = new SqlCommand(sqlstr, conn)) { SqlDataReader dr = cmd.ExecuteReader(); string blogstatus = "", ifhdell = "", empno = "", dpttitle = ""; string SEtime = "自{0}({1}時)<br>至{2}({3}時)"; string blogsdate = "", blogstime = "", blogedate = "", blogetime = ""; string resthour = "", moneyhour = "", sql = ""; while (dr.Read()) { blogstatus = dbobj.get_dbnull2(dr["otstatus"]); switch (blogstatus) { case "0": blogstatus = "簽核中"; break; case "1": blogstatus = "已核准"; break; case "2": blogstatus = "退回"; break; case "D": blogstatus = "撤回"; break; default: break; } ifhdell = dbobj.get_dbnull2(dr["ifotdell"]); if (ifhdell == "y") { ifhdell = "是"; } else if (ifhdell == "n") { ifhdell = "否"; } blogsdate = Convert.ToDateTime(dbobj.get_dbnull2(dr["otlogsdate"])).ToString("yyyy/MM/dd"); blogstime = int.Parse(dbobj.get_dbnull2(dr["otlogstime"])).ToString("00"); blogedate = Convert.ToDateTime(dbobj.get_dbnull2(dr["otlogedate"])).ToString("yyyy/MM/dd"); blogetime = int.Parse(dbobj.get_dbnull2(dr["otlogetime"])).ToString("00"); using (SqlConnection comconn = dbobj.get_conn("Aitag_DBContext")) { empno = "select empno from employee where empid='" + dbobj.get_dbnull2(dr["empid"]) + "'"; empno = dbobj.get_dbvalue(comconn, empno); dpttitle = "select dpttitle from Department where dptid='" + dbobj.get_dbnull2(dr["dptid"]) + "' and comid='" + (string)Session["comid"] + "'"; dpttitle = dbobj.get_dbvalue(comconn, dpttitle); sql = "select * from resthourlog where osno = '" + dbobj.get_dbnull2(dbobj.get_dbnull2(dr["osno"])) + "' and comid='" + (string)Session["comid"] + "'"; using (SqlCommand cmd1 = new SqlCommand(sql, comconn)) { SqlDataReader dr1 = cmd1.ExecuteReader(); if (dr1.HasRows) { dr1.Read(); resthour = dbobj.get_dbnull2(dr1["resthour"]); moneyhour = dbobj.get_dbnull2(dr1["moneyhour"]); } else { resthour = "0"; moneyhour = "0"; } dr1.Close(); } } Excel2 += "<tr>"; Excel2 += "<td>" + blogstatus + "</td>"; Excel2 += "<td>" + ifhdell + "</td>"; Excel2 += "<td>" + empno + "</td>"; Excel2 += "<td>" + dbobj.get_dbnull2(dr["empname"]) + "</td>"; Excel2 += "<td>" + dpttitle + "</td>"; Excel2 += "<td>" + String.Format(SEtime, blogsdate, blogstime, blogedate, blogetime) + "</td>"; Excel2 += "<td>" + dbobj.get_dbnull2(dr["otloghour"]) + "</td>"; Excel2 += "<td>" + resthour + "</td>"; Excel2 += "<td>" + moneyhour + "</td>"; Excel2 += "</tr>"; } if (Excel2 == "") { Excel += "<tr align=left><td colspan=6>目前沒有資料</td></tr>"; } else { Excel2 += "<tr>"; Excel2 += "<td>總計</td>"; Excel2 += "<td> </td>"; Excel2 += "<td> </td>"; Excel2 += "<td> </td>"; Excel2 += "<td> </td>"; Excel2 += "<td> </td>"; Excel2 += "<td>" + ViewBag.otloghour + "</td>"; Excel2 += "<td>" + ViewBag.sumresthour + "</td>"; Excel2 += "<td>" + ViewBag.summoneyhour + "</td>"; Excel2 += "</tr>"; Excel += Excel2; } dr.Close(); } } Excel += "</table>"; Excel += "</body>"; Excel += "</HTML>"; ViewBag.Excel = Excel; #endregion return(View()); }
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 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 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 adddo(string sysflag, 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 = "", qsdate = "", qedate = ""; 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; } if (!string.IsNullOrWhiteSpace(Request["qsdate"])) { qsdate = Request["qsdate"].Trim(); ViewBag.qsdate = qsdate; } if (!string.IsNullOrWhiteSpace(Request["qedate"])) { qedate = Request["qedate"].Trim(); ViewBag.qedate = qedate; } NDcommon dbobj = new NDcommon(); SqlConnection erpconn = dbobj.get_conn("AitagBill_DBContext"); SqlConnection erpconn1 = dbobj.get_conn("AitagBill_DBContext"); using (AitagBill_DBContext con = new AitagBill_DBContext()) { string tmpssql = ""; int strym = 0; int etrym = 0; //找審過過單 tmpssql = "select (payvendcomid) as vendno, isnull(sum(psummoney),0) as psummoney FROM vend_contractinvclose INNER JOIN vend_contractinvclose_det ON vend_contractinvclose.vcinvid =vend_contractinvclose_det.vcinvid where vstatus<>'D' "; switch (qbseason) { case "01": //月獎 tmpssql += " and slyear =" + qslyear + " and slmonth = " + qslmonth + " group by payvendcomid "; break; case "02": //季獎 3 / 6 / 9/ 12 strym = 365 * int.Parse(qslyear) + 30 * int.Parse(qslmonth); //etrym = qslyear.ToString() + qslmonth.ToString().PadLeft(2, '0'); if (qslmonth.ToString().PadLeft(2, '0') == "03") { strym = 365 * int.Parse(qslyear) + 30 * 1; etrym = 365 * int.Parse(qslyear) + 30 * 3; } else if (qslmonth.ToString().PadLeft(2, '0') == "06") { strym = 365 * int.Parse(qslyear) + 30 * 4; etrym = 365 * int.Parse(qslyear) + 30 * 6; } else if (qslmonth.ToString().PadLeft(2, '0') == "09") { strym = 365 * int.Parse(qslyear) + 30 * 7; etrym = 365 * int.Parse(qslyear) + 30 * 9; } else if (qslmonth.ToString().PadLeft(2, '0') == "12") { strym = 365 * int.Parse(qslyear) + 30 * 10; etrym = 365 * int.Parse(qslyear) + 30 * 12; } tmpssql += " and (slyear * 365 + slmonth * 30) >= " + strym.ToString() + " and (slyear * 365 + slmonth * 30) <= " + etrym.ToString() + " group by payvendcomid "; break; case "03": //半年獎 06 / 12 strym = 365 * int.Parse(qslyear) + 30 * int.Parse(qslmonth); //etrym = qslyear.ToString() + qslmonth.ToString().PadLeft(2, '0'); if (qslmonth.ToString().PadLeft(2, '0') == "06") { strym = 365 * int.Parse(qslyear) + 30 * 1; etrym = 365 * int.Parse(qslyear) + 30 * 6; } else if (qslmonth.ToString().PadLeft(2, '0') == "12") { strym = 365 * int.Parse(qslyear) + 30 * 7; etrym = 365 * int.Parse(qslyear) + 30 * 12; } tmpssql += " and (slyear * 365 + slmonth * 30) >= " + strym.ToString() + " and (slyear * 365 + slmonth * 30) <= " + etrym.ToString() + " group by payvendcomid "; break; case "04": //年獎 tmpssql += " and year(vadate) =" + qslyear + " group by payvendcomid "; break; } SqlDataReader dr = dbobj.dbselect(erpconn, tmpssql); string iftax = ""; if (dr.HasRows) { while (dr.Read()) { decimal tmprate = 0; decimal tmppsummoney = decimal.Parse(dr["psummoney"].ToString()); decimal pallbonusmoney = tmppsummoney; // 找 廠商/客戶的 計算方式 , vendno 在客戶計算是客戶的欄位 //tmpssql = "select * from allcompany_rate where bseason='" + qbseason + "' and allcomid='" + dr["vendno"].ToString() + "' and (bsmoney <=" + tmppsummoney + " and bemoney >=" + tmppsummoney + " )"; //單筆金額 tmpssql = "select * from allcompany_rate where bseason='" + qbseason + "' and allcomid='" + dr["vendno"].ToString() + "' and btype = '0'"; SqlDataReader dr1 = dbobj.dbselect(erpconn1, tmpssql); if (dr1.Read()) { pallbonusmoney = decimal.Parse(dr1["brate"].ToString()); } dr1.Close(); dr1.Dispose(); //單筆比例 tmpssql = "select * from allcompany_rate where bseason='" + qbseason + "' and allcomid='" + dr["vendno"].ToString() + "' and btype = '1'"; dr1 = dbobj.dbselect(erpconn1, tmpssql); if (dr1.Read()) { iftax = dr1["brate"].ToString(); tmprate = decimal.Parse(dr1["brate"].ToString()); if (iftax == "0") { pallbonusmoney = pallbonusmoney * tmprate / 100; } else { pallbonusmoney = (pallbonusmoney * tmprate * decimal.Parse("1.05")) / 100; } } dr1.Close(); dr1.Dispose(); //落點金額比例 tmpssql = "select * from allcompany_rate where bseason='" + qbseason + "' and allcomid='" + dr["vendno"].ToString() + "' and btype = '2' and (bsmoney <=" + tmppsummoney + " and bemoney >=" + tmppsummoney + ")"; dr1 = dbobj.dbselect(erpconn1, tmpssql); if (dr1.Read()) { iftax = dr1["brate"].ToString(); tmprate = decimal.Parse(dr1["brate"].ToString()); if (iftax == "0") { pallbonusmoney = pallbonusmoney * tmprate / 100; } else { pallbonusmoney = (pallbonusmoney * tmprate * decimal.Parse("1.05")) / 100; } } dr1.Close(); dr1.Dispose(); //累積金額比例 tmpssql = "select * from allcompany_rate where bseason='" + qbseason + "' and allcomid='" + dr["vendno"].ToString() + "' and btype = '3' and (bsmoney <=" + tmppsummoney + " and bemoney >=" + tmppsummoney + ")"; dr1 = dbobj.dbselect(erpconn1, tmpssql); if (dr1.Read()) { iftax = dr1["brate"].ToString(); tmprate = decimal.Parse(dr1["brate"].ToString()); if (iftax == "0") { pallbonusmoney = pallbonusmoney * tmprate / 100; } else { pallbonusmoney = (pallbonusmoney * tmprate * decimal.Parse("1.05")) / 100; } } dr1.Close(); dr1.Dispose(); vend_monthmoney addobj = new vend_monthmoney(); addobj.bseason = qbseason; //01:月獎 02:季獎 03:半年獎 04:年獎 05:現折 addobj.slyear = int.Parse(qslyear); if (qbseason == "04") { addobj.slmonth = 12; } else { addobj.slmonth = int.Parse(qslmonth); } addobj.vendcomid = dr["vendno"].ToString(); addobj.vtype = "2";//1:收入 2:支出 addobj.pallbonusmoney = pallbonusmoney; addobj.pallmoney = tmppsummoney; addobj.bmodid = Session["empid"].ToString(); addobj.bmoddate = DateTime.Now; addobj.comid = Session["comid"].ToString(); con.vend_monthmoney.Add(addobj); } } con.SaveChanges(); con.Dispose(); } erpconn.Close(); erpconn.Dispose(); erpconn1.Close(); erpconn1.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 = @"" + tmpform }); }
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 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 newlogin(string comidrid, string comid) { string tmppath1 = ""; string tmpsid = ""; string tmprealsid = ""; tmppath1 = Request["path1"]; tmpsid = Request["sid"]; tmprealsid = Request["realsid"]; if (!string.IsNullOrWhiteSpace(comidrid)) { Session["rid"] = comidrid; Session["mplayrole"] = "'" + comidrid + "'"; } if (!string.IsNullOrWhiteSpace(comid)) { Session["comid"] = comid; NDcommon dbobj = new NDcommon(); SqlConnection tmpconn = dbobj.get_conn("Aitag_DBContext"); Session["logopic"] = dbobj.get_dbvalue(tmpconn, "select logopic from company where comid = '" + comid + "'"); tmpconn.Close(); tmpconn.Dispose(); } if (tmppath1 == "" || tmppath1 == null) { if (Session["mtid"] == "A0032") { return(new ContentResult() { Content = @"<script>location.href='/paybill'</script>" }); } else { return(new ContentResult() { Content = @"<script>location.href='/main'</script>" }); } } else { if (tmpsid == "510") { Session["mtid"] = "A0032"; } else { Session["mtid"] = "A004"; } Session["sid"] = tmpsid; Session["realsid"] = tmprealsid; return(new ContentResult() { Content = @"<script>location.href='/" + tmppath1 + "'</script>" }); } //return View(); }
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 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(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 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 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(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 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 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 }); } }
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 fileuploadDB() { string realsid = Request["realsid"].ToString(); string mcid = Request["mcid"].ToString(); if (mcid == "") { mcid = Session["mcid"].ToString(); } string qmcparentid = Request["qmcparentid"].ToString(); string cfilename = Request["cfilename"].ToString(); string vfilename = Request["vfilename"].ToString(); string cfilesize = Request["cfilesize"].ToString(); NDcommon dbobj = new NDcommon(); System.IO.File.Copy(Server.MapPath(Imglink + "/upload/" + cfilename), Server.MapPath(Imglink + "/upload/" + vfilename)); System.IO.File.Delete(Server.MapPath(Imglink + "/upload/" + cfilename)); using (Aitag_DBContext con = new Aitag_DBContext()) { SqlConnection conn = dbobj.get_conn("Aitag_DBContext"); SqlDataReader dr; SqlCommand sqlsmd = new SqlCommand(); sqlsmd.Connection = conn; //取得功能代號 string sqlstr = "select * from sublevel1 where sid = '" + realsid + "'"; sqlsmd.CommandText = sqlstr; dr = sqlsmd.ExecuteReader(); string functype = ""; if (dr.Read()) { functype = dr["functype"].ToString(); } dr.Close(); dr.Dispose(); if (mcid == "") { maincontent mainobj = new maincontent(); if (qmcparentid != "") { mainobj.mcparentid = int.Parse(qmcparentid); } mainobj.mctitle = ""; mainobj.mchttp = ""; mainobj.mctype = functype; mainobj.sid = int.Parse(realsid); mainobj.readallman = ""; mainobj.mdate = DateTime.Today; mainobj.mclick = 0; mainobj.ownman = Session["empid"].ToString(); mainobj.comid = Session["comid"].ToString(); mainobj.bmodid = Session["empid"].ToString(); mainobj.bmoddate = DateTime.Today; con.maincontent.Add(mainobj); con.SaveChanges(); sqlstr = "select top 1 * from maincontent where ownman = '" + Session["empid"].ToString() + "' order by mcid desc"; sqlsmd.CommandText = sqlstr; dr = sqlsmd.ExecuteReader(); if (dr.Read()) { mcid = dr["mcid"].ToString(); } dr.Close(); dr.Dispose(); Session["mcid"] = mcid; } conn.Close(); conn.Dispose(); contupload addobj = new contupload(); addobj.cfilename = cfilename; addobj.cfilesize = int.Parse(cfilesize); addobj.mcid = int.Parse(mcid); addobj.cfiletitle = cfilename; addobj.cupfile = vfilename; addobj.bmodid = Session["empid"].ToString(); addobj.bmoddate = DateTime.Now; con.contupload.Add(addobj); con.SaveChanges(); con.Dispose(); } string tmpdata = mcid; return(new ContentResult() { Content = @"" + tmpdata }); }
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 detlistdo(string sysflag, int?page, string orderdata, string orderdata1) { NDcommon dbobj = new NDcommon(); SqlConnection erpconn = dbobj.get_conn("AitagBill_DBContext"); SqlCommand cmd = new SqlCommand(); string wno = "", comid = ""; using (AitagBill_DBContext con = new AitagBill_DBContext()) { page = ((!page.HasValue || page < 1) ? 1 : page); ViewBag.page = page; ViewBag.orderdata = orderdata; ViewBag.orderdata1 = orderdata1; string sqlstr = ""; string cdel1 = Request["wkdid"]; string wkcdate1 = Request["wkcdate"]; string wkstep1 = Request["wkstep"]; string getman1 = Request["getman"]; string prdate1 = Request["prdate"]; string realdate1 = Request["realdate"]; string worktype1 = Request["worktype"]; string makeitem1 = Request["makeitem"]; string[] cdelarr = cdel1.Split(','); string[] wkcdatedarr = wkcdate1.Split(','); string[] wksteparr = wkstep1.Split(','); string[] getmanarr = getman1.Split(','); string[] prdatearr = prdate1.Split(','); string[] realdatearr = realdate1.Split(','); string[] worktypearr = worktype1.Split(','); string[] makeitemrr = makeitem1.Split(','); wno = Request["wno"].ToString(); comid = Request["comid"].ToString(); for (int i = 0; i < cdelarr.Length; i++) { if (cdelarr[i].Trim() == "") { if (!(wkcdatedarr[i].Trim() == "" && wksteparr[i].Trim() == "")) { workcard_det addobj = new workcard_det(); addobj.comid = comid; addobj.wno = wno; addobj.wkcdate = DateTime.Parse(wkcdatedarr[i].ToString()); addobj.wkstep = wksteparr[i].Trim(); addobj.getman = getmanarr[i].Trim(); addobj.bmodid = Session["empid"].ToString(); addobj.bmoddate = DateTime.Now; if (prdatearr[i].ToString() != "") { addobj.prdate = DateTime.Parse(prdatearr[i].ToString()); } else { addobj.prdate = null; } if (realdatearr[i].ToString() != "") { addobj.realdate = DateTime.Parse(realdatearr[i].ToString()); } else { addobj.realdate = null; } addobj.worktype = worktypearr[i].Trim(); addobj.makeitem = makeitemrr[i].Trim(); con.workcard_det.Add(addobj); con.SaveChanges(); } } else { //修改 int wkdid = int.Parse(cdelarr[i].Trim()); workcard_det modobj = con.workcard_det.Where(r => r.wkdid == wkdid).FirstOrDefault(); modobj.wkcdate = DateTime.Parse(wkcdatedarr[i].ToString()); modobj.wkstep = wksteparr[i].Trim(); modobj.getman = getmanarr[i].Trim(); if (prdatearr[i].ToString() != "") { modobj.prdate = DateTime.Parse(prdatearr[i].ToString()); } else { modobj.prdate = null; } if (realdatearr[i].ToString() != "") { modobj.realdate = DateTime.Parse(realdatearr[i].ToString()); } else { modobj.realdate = null; } modobj.worktype = worktypearr[i].Trim(); modobj.makeitem = makeitemrr[i].Trim(); modobj.bmodid = Session["empid"].ToString(); modobj.bmoddate = DateTime.Now; con.Entry(modobj).State = EntityState.Modified; con.SaveChanges(); } } con.Dispose(); } string tmpform = ""; tmpform = "<body onload=qfr1.submit();>"; tmpform += "<form name='qfr1' action='/workcard/detlist' 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='wno' id='wno' value='" + wno + "'>"; tmpform += "<input type=hidden name='comid' id='comid' value='" + comid + "'>"; tmpform += "</body>"; erpconn.Close(); erpconn.Dispose(); return(new ContentResult() { Content = @"" + tmpform }); }