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");
                }
            }
        }
Example #2
0
        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
                    });
                }
            }
        }
Example #3
0
        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");
                }
            }
        }
Example #4
0
        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
                    });
                }
            }
        }
Example #5
0
        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 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 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 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 = "&nbsp;";
                                    }
                                    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
                });
            }
        }
        private void delholidayMode(delholidaylog col, string hdellogstatus)
        {
            NDcommon dbobj = new NDcommon();

            using (SqlConnection comconn = dbobj.get_conn("Aitag_DBContext"))
            {
                if (col.hdayid == "A04")
                {
                    #region  '請補假部分
                    resthourlog chks = new resthourlog();
                    chks.empid      = col.empid;
                    chks.rsdeaddate = col.hlogsdate;

                    using (Aitag_DBContext con = new Aitag_DBContext())
                    {
                        var   eresthourlogs = con.resthourlog.Where(r => r.empid == chks.empid && r.rsdeaddate >= chks.rsdeaddate).OrderBy(r => r.rsdeaddate);
                        float tmphloghour   = float.Parse(col.hloghour.ToString());
                        foreach (resthourlog es in eresthourlogs)
                        {
                            var lefthour = es.usehour - tmphloghour;
                            if (lefthour >= 0)
                            {
                                es.usehour -= tmphloghour;
                                using (Aitag_DBContext con2 = new Aitag_DBContext())
                                {
                                    con2.Entry(es).State = EntityState.Modified;
                                    con2.SaveChanges();
                                }
                                if (lefthour == 0)
                                {
                                    break;
                                }
                            }
                            else
                            {
                                es.usehour = 0;
                                using (Aitag_DBContext con2 = new Aitag_DBContext())
                                {
                                    con2.Entry(es).State = EntityState.Modified;
                                    con2.SaveChanges();
                                }
                                tmphloghour = float.Parse(Math.Abs(decimal.Parse(lefthour.ToString())).ToString());
                            }
                        }
                    }
                    #endregion
                }
                else
                {
                    #region  事實發生假部分
                    string   mergehdayid = dbobj.get_dbvalue(comconn, "select * from holidaycode where hdayid = '" + col.hdayid + "'");;
                    string   sql         = "";
                    emphdlog chks        = new emphdlog();


                    if (mergehdayid != "")
                    {
                        chks.empid  = col.empid;
                        chks.hdayid = mergehdayid;
                    }
                    else
                    {
                        chks.empid  = col.empid;
                        chks.hdayid = col.hdayid;
                    }
                    using (Aitag_DBContext con = new Aitag_DBContext())
                    {
                        emphdlog eemphdlogs = con.emphdlog.Where(r => r.empid == chks.empid && r.hdayid == chks.hdayid).FirstOrDefault();

                        if (eemphdlogs != null)
                        {
                            eemphdlogs.usehour          = eemphdlogs.usehour - decimal.Parse(col.hloghour.ToString());
                            con.Entry(eemphdlogs).State = EntityState.Modified;
                            con.SaveChanges();

                            if (eemphdlogs.usehour == 0)
                            {
                                if (mergehdayid != "")
                                {
                                    sql = "delete emphdlog where empid = '" + col.empid + "' and hdayid = '" + mergehdayid + "'";
                                }
                                else
                                {
                                    sql = "delete emphdlog where empid = '" + col.empid + "' and hdayid = '" + col.hdayid + "'";
                                }
                                dbobj.dbexecute("Aitag_DBContext", sql);
                            }
                        }
                    }
                    #endregion
                }
            }
        }
        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");
                }
            }
        }
Example #11
0
        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
                    });
                }
            }
        }
Example #12
0
        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");
                }
            }
        }
        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");
            }
        }
Example #14
0
        public ActionResult DeleteConfirmed(string id, int?page)
        {
            page = ((!page.HasValue || page < 1) ? 1 : page);
            string qkeyword = "", qsmdate = "", qemdate = "", qmclassid = "";

            if (!string.IsNullOrWhiteSpace(Request["qkeyword"]))
            {
                qkeyword         = Request["qkeyword"].Trim();
                ViewBag.qkeyword = qkeyword;
            }
            if (!string.IsNullOrWhiteSpace(Request["qsmdate"]))
            {
                qsmdate         = Request["qsmdate"].Trim();
                ViewBag.qsmdate = qsmdate;
            }
            if (!string.IsNullOrWhiteSpace(Request["qemdate"]))
            {
                qemdate         = Request["qemdate"].Trim();
                ViewBag.qemdate = qemdate;
            }
            if (!string.IsNullOrWhiteSpace(Request["qmclassid"]))
            {
                qmclassid         = Request["qmclassid"].Trim();
                ViewBag.qmclassid = qmclassid;
            }
            string cdel = Request["cdel"];

            if (string.IsNullOrWhiteSpace(cdel))
            {
                string tgourl = "/oa/maincontent?page=" + page + "&qkeyword=" + qkeyword + "&qsmdate=" + qsmdate + "&qemdate=" + qemdate + "&qmclassid=" + qmclassid;
                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 maincontent1 = dbobj.get_dbvalue(conn1, "select mctitle from maincontent where mcid ='" + condtionArr[i].ToString() + "'");

                        sysnote += "標題名稱:" + maincontent1 + ",序號:" + condtionArr[i].ToString() + "<br>";

                        dbobj.dbexecute("Aitag_DBContext", "DELETE FROM maincontent where mcid = '" + condtionArr[i].ToString() + "'");

                        //砍檔案
                        string     sql = "select * from contupload where mcid = '" + condtionArr[i].ToString() + "'";
                        SqlCommand cmd = new SqlCommand();
                        cmd.Connection  = conn1;
                        cmd.CommandText = sql;
                        SqlDataReader rs1 = cmd.ExecuteReader();
                        while (rs1.Read())
                        {
                            //砍檔案
                            try
                            {
                                System.IO.File.Delete(Server.MapPath("/upload/" + rs1["cupfile"].ToString()));
                                System.IO.File.Delete(Server.MapPath("/downfile/" + rs1["cfilename"].ToString()));
                            }
                            catch (Exception e)
                            {; }
                        }
                        rs1.Close();
                        rs1.Dispose();

                        dbobj.dbexecute("Aitag_DBContext", "DELETE FROM contupload where mcid = '" + 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 = "/oa/maincontent?page=" + page + "&qkeyword=" + qkeyword + "&qsmdate=" + qsmdate + "&qemdate=" + qemdate + "&qmclassid=" + qmclassid;
                    return(new ContentResult()
                    {
                        Content = @"<script>alert('刪除成功!!');location.href='" + tgourl + "'</script>"
                    });

                    //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");
                }
            }
        }
Example #16
0
        public ActionResult DeleteConfirmed(string id, int?page)
        {
            page = ((!page.HasValue || page < 1) ? 1 : page);
            string qcomid = "", qsflag = "", qslaccount = "", qsltext = "", qsodate1 = "", qsodate2 = "";
            string sql = "", sqlwhere = "";
            string maxcomid = System.Configuration.ConfigurationManager.AppSettings["maxcomid"].ToString();

            if (maxcomid == (string)(Session["maxcomid"]) || (string)(Session["maxcomid"]) == null)
            {
                sql = "delete from systemlog where";
            }
            else
            {
                sql = "delete from systemlog where comid='" + (string)(Session["maxcomid"]) + "'  and";
            }


            if (!string.IsNullOrWhiteSpace(Request["qcomid"]))
            {
                qcomid    = Request["qcomid"].Trim();
                sqlwhere += " comid = '" + qcomid + "'  and";
                //ViewBag.qcomid = qcomid;
            }
            if (!string.IsNullOrWhiteSpace(Request["qsflag"]))
            {
                qsflag    = Request["qsflag"].Trim();
                sqlwhere += " sflag = '" + qsflag + "'  and";
                //ViewBag.qsflag = qsflag;
            }
            if (!string.IsNullOrWhiteSpace(Request["qslaccount"]))
            {
                qslaccount = Request["qslaccount"].Trim();
                sqlwhere  += " slaccount = '" + qslaccount + "'  and";
                //ViewBag.qslaccount = qslaccount;
            }
            if (!string.IsNullOrWhiteSpace(Request["qsltext"]))
            {
                qsltext   = Request["qsltext"].Trim();
                sqlwhere += " (slevent like N'%" + qsltext + "%' or sname like N'%" + qsltext + "%')  and";
                //ViewBag.qsltext = qsltext;
            }
            if (!string.IsNullOrWhiteSpace(Request["qsodate1"]))
            {
                qsodate1 = Request["qsodate1"].Trim();
                //ViewBag.qsodate1 = qsodate1;
            }
            else
            {
                qsodate1 = DateTime.Now.ToString("yyyy") + "/1/1";
            }
            if (!string.IsNullOrWhiteSpace(Request["qsodate2"]))
            {
                qsodate2 = Request["qsodate2"].Trim();
                //ViewBag.qsodate2 = qsodate2;
            }
            else
            {
                DateTime date2 = new DateTime(DateTime.Now.Year + 1, 1, 1);
                date2    = date2.AddDays(-1);
                qsodate2 = date2.ToString("yyyy/MM/dd");
            }

            string DateEx = "";

            try
            {
                DateTime.Parse(qsodate1);
                sqlwhere += " sodate >= '" + qsodate1 + "'  and";
            }
            catch
            {
                DateEx += @"異動時間起格式錯誤!!\n";
            }
            try
            {
                DateTime.Parse(qsodate2);
                sqlwhere += " sodate <= '" + qsodate2 + "'  and";
            }
            catch
            {
                DateEx += @"異動時間訖格式錯誤!!\n";
            }
            if (DateEx != "")
            {
                ViewBag.DateEx = @"<script>alert(""" + DateEx + @""");</script>";
            }
            else
            {
                sqlwhere = sqlwhere.Substring(0, sqlwhere.Length - 5);
                sql      = sql + sqlwhere;
                NDcommon dbobj = new NDcommon();
                dbobj.dbexecute("Aitag_DBContext", sql);
            }



            string tmpform = "";

            //tmpform += @"<script>alert('刪除成功!!');</script>";
            tmpform  = "<body onload=qfr1.submit();>";
            tmpform += "<form name='qfr1' action='/systemlog/List' method='post'>";

            tmpform += @"<input type=hidden name='qcomid' value='" + qcomid + "' >";
            tmpform += @"<input type=hidden name='qsflag' value='" + qsflag + "' >";
            tmpform += @"<input type=hidden name='qslaccount' value='" + qslaccount + "' >";
            tmpform += @"<input type=hidden name='qsltext' value='" + qsltext + "' >";
            tmpform += @"<input type=hidden name='qsodate1' value='" + qsodate1 + "' >";
            tmpform += @"<input type=hidden name='qsodate2' value='" + qsodate2 + "' >";

            //不回傳順序、頁碼
            tmpform += @"<input type=hidden name='page' value='' >";
            tmpform += @"<input type=hidden name='orderdata' value='' >";
            tmpform += @"<input type=hidden name='orderdata1' value='' >";
            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");
                    }
                }
            }
        }
Example #18
0
        public ActionResult battadatdo(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 qblogstatus = "", qempname = "", qdptid = "", qblogsdate = "", qblogedate = "";

            if (!string.IsNullOrWhiteSpace(Request["qblogstatus"]))
            {
                qblogstatus         = Request["qblogstatus"].Trim();
                ViewBag.qblogstatus = qblogstatus;
            }
            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["qblogsdate"]))
            {
                qblogsdate         = Request["qblogsdate"].Trim();
                ViewBag.qblogsdate = qblogsdate;
            }
            if (!string.IsNullOrWhiteSpace(Request["qblogedate"]))
            {
                qblogedate         = Request["qblogedate"].Trim();
                ViewBag.qblogedate = qblogedate;
            }


            string tmpform = "";

            tmpform  = "<body onload=qfr1.submit();>";
            tmpform += "<form name='qfr1' action='/battadata/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='qblogstatus' name='qblogstatus' value='" + qblogstatus + "'>";
            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='qblogsdate' name='qblogsdate' value='" + qblogsdate + "'>";
            tmpform += "<input type=hidden id='qblogedate' name='qblogedate' value='" + qblogedate + "'>";

            tmpform += "</form>";
            tmpform += "</body>";
            NDcommon dbobj = new NDcommon();

            string cdel = Request["cdel"];

            string sql = "", sqlwhere = "", tmpcomment = "";

            if (string.IsNullOrWhiteSpace(cdel))
            {
                if (dbobj.get_dbnull2(Request["blogid"]) != "")
                {
                    sql      = "select * from battalog";
                    sqlwhere = " where blogid=" + dbobj.get_dbnull2(Request["blogid"]) + " and comid='" + (string)Session["comid"] + "'";
                    sql     += sqlwhere;
                    dbobj.dbexecute("Aitag_DBContext", "UPDATE battalog ifhdell='y' " + sqlwhere);
                    using (SqlConnection conn = dbobj.get_conn("Aitag_DBContext"))
                    {
                        using (SqlCommand cmd = new SqlCommand(sql, conn))
                        {
                            SqlDataReader dr = cmd.ExecuteReader();
                            if (dr.HasRows)
                            {
                                dr.Read();
                                //找是否己全部核銷了
                                sql = "select * from battalog where pbsno='" + dbobj.get_dbnull2(dr["pbsno"]) + "' and comid='" + (string)Session["comid"] + "' and ifhdell='n'";
                                using (SqlConnection conn1 = dbobj.get_conn("Aitag_DBContext"))
                                {
                                    using (SqlCommand cmd1 = new SqlCommand(sql, conn1))
                                    {
                                        SqlDataReader dr1 = cmd1.ExecuteReader();
                                        if (dr1.HasRows)
                                        {
                                            while (dr1.Read())
                                            {
                                                sql = "UPDATE battalog SET ifhdell='y' where bsno='" + dbobj.get_dbnull2(dr["pbsno"]) + "' and comid='" + (string)Session["comid"] + "'";
                                                dbobj.dbexecute("Aitag_DBContext", sql);
                                            }
                                        }
                                        dr1.Close();
                                    }
                                }

                                tmpcomment = "申請人:" + dbobj.get_dbnull2(dr["empname"]) + "<br>申請單號:" + dbobj.get_dbnull2(dr["bsno"]) + "的資料";
                            }
                            dr.Close();
                        }
                    }



                    return(new ContentResult()
                    {
                        Content = @"<script>alert('核銷成功!!');</script>" + tmpform
                    });
                }
                else
                {
                    return(new ContentResult()
                    {
                        Content = @"<script>alert('請選擇要核銷的資料。');</script>" + tmpform
                    });
                }
            }
            else
            {
                string chkdel  = cdel;
                Int16  mpcount = 0;
                tmpcomment = "";
                sql        = "select * from battalog";
                sqlwhere   = " where blogid in (" + chkdel + ") and comid='" + (string)Session["comid"] + "'";
                sql       += sqlwhere;
                using (SqlConnection conn = dbobj.get_conn("Aitag_DBContext"))
                {
                    using (SqlConnection comconn = dbobj.get_conn("Aitag_DBContext"))
                    {
                        using (SqlCommand cmd = new SqlCommand(sql, conn))
                        {
                            SqlDataReader dr = cmd.ExecuteReader();
                            if (dr.HasRows)
                            {
                                while (dr.Read())
                                {
                                    sql = "UPDATE battalog SET ifhdell='y' where blogid=" + dbobj.get_dbnull2(dr["blogid"]) + " and comid='" + (string)Session["comid"] + "'";
                                    dbobj.dbexecute("Aitag_DBContext", sql);

                                    //找是否己全部核銷了
                                    sql = "select * from battalog where pbsno='" + dbobj.get_dbnull2(dr["pbsno"]) + "' and comid='" + (string)Session["comid"] + "' and ifhdell='n'";
                                    using (SqlConnection conn1 = dbobj.get_conn("Aitag_DBContext"))
                                    {
                                        using (SqlCommand cmd1 = new SqlCommand(sql, conn1))
                                        {
                                            SqlDataReader dr1 = cmd1.ExecuteReader();
                                            if (dr1.HasRows)
                                            {
                                                while (dr1.Read())
                                                {
                                                    sql = "UPDATE battalog SET ifhdell='y' where bsno='" + dbobj.get_dbnull2(dr["pbsno"]) + "' and comid='" + (string)Session["comid"] + "'";
                                                    dbobj.dbexecute("Aitag_DBContext", sql);
                                                }
                                            }
                                            dr1.Close();
                                        }
                                    }



                                    mpcount++;
                                    tmpcomment += "姓名:" + dbobj.get_dbnull2(dr["empname"]) + ",申請單號:" + dbobj.get_dbnull2(dr["bsno"]) + "<br>";
                                }
                                tmpcomment  = tmpcomment.Substring(0, tmpcomment.Length - 4);
                                tmpcomment += "的資料" + mpcount + "筆";
                            }


                            //系統LOG檔
                            string sysnote = tmpcomment;
                            if (sysnote.Length > 4000)
                            {
                                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    = "M";
                            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
                });
            }
        }