Beispiel #1
0
    public static int UpdateUserData(
        string strUserID,
        string strAuthority,
        string strPassword,
        string strChName,
        string strEnName,
        string strMailAddress,
        string strYearly,
        string strStudentNum,
        string strJobGrade,
        string strBirthday
        )
    {
        //取得學生流水號
        string strSerialNum = GetUserSerialNumberByUserID(strUserID);

        string strUpdate_UserData =
            "UPDATE [NewVersionHintsDB].[dbo].[UserData] SET cName=@cName, " +
            "cPassword=@cPassword, cMailAddress=@cMailAddress " +
            "WHERE cUserID=@cuserID ";

        object[] pList_UserData = { strChName, strPassword, strMailAddress, strUserID };
        try
        {
            sqlAllSystemDB.ExecuteNonQuery(strUpdate_UserData, pList_UserData);
        }
        catch
        {
            return(-1);
        }
        //HINTS
        string strHintsAuthority            = GetTransAuthority(SystemName_Hints, strAuthority);
        string strUpdate_UserHintsExtraData =
            "UPDATE [NewVersionHintsDB].[dbo].[UserHintsExtraData] SET " +
            " cHints_Authority=@cHints_Authority, cHints_EngName=@cHints_EngName, cHints_IdNumber=@cHints_IdNumber" +
            " WHERE cUserSerialNumber = " + strSerialNum;

        object[] pList_UserHintsExtraData = { strHintsAuthority, strEnName, strStudentNum };
        try
        {
            sqlAllSystemDB.ExecuteNonQuery(strUpdate_UserHintsExtraData, pList_UserHintsExtraData);
        }
        catch
        {
            return(-1);
        }
        //MLAS
        //密碼(MD5)
        string strPassword_MD5             = FormsAuthentication.HashPasswordForStoringInConfigFile(strPassword, "md5");
        string strMLASAuthority            = GetTransAuthority(SystemName_MLAS, strAuthority);
        string strUpdate_UserMLASExtraData =
            "UPDATE [NewVersionHintsDB].[dbo].[UserMLASExtraData] SET " +
            " cMLAS_Authority=@cMLAS_Authority, cMLAS_Password_MD5=@cMLAS_Password_MD5, cMLAS_Yearly=@cMLAS_Yearly," +
            " cMLAS_JobGrade=@cMLAS_JobGrade,cMLAS_Birthday=@cMLAS_Birthday " +
            " WHERE cUserSerialNumber = " + strSerialNum;

        object[] pList_UserMLASExtraData = { strMLASAuthority, strPassword_MD5, strYearly, strJobGrade, strBirthday };
        try
        {
            sqlAllSystemDB.ExecuteNonQuery(strUpdate_UserMLASExtraData, pList_UserMLASExtraData);
        }
        catch
        {
            return(-1);
        }
        //ORCS
        string strORCSAuthority            = GetTransAuthority(SystemName_ORCS, strAuthority);
        string strUpdate_UserORCSExtraData =
            "UPDATE [NewVersionHintsDB].[dbo].[UserORCSExtraData] SET " +
            " cORCS_Authority=@cORCS_Authority " +
            "WHERE cUserSerialNumber = " + strSerialNum;

        object[] pList_UserORCSExtraData = { strORCSAuthority };
        try
        {
            sqlAllSystemDB.ExecuteNonQuery(strUpdate_UserORCSExtraData, pList_UserORCSExtraData);
        }
        catch
        {
            return(-1);
        }

        return(1);
    }
        private void btnNext_ServerClick(object sender, EventArgs e)
        {
            //取得使用者所選取的功能
            string strQuestionFunction = "";

            if (rb1.Checked == true)
            {
                //新增題目
                strQuestionFunction = "New";

                //設定bModify
                if (Session["bModify"] != null)
                {
                    Session["bModify"] = false;
                }
                else
                {
                    Session.Add("bModify", false);
                }
            }
            else
            {
                //修改或是刪除題目
                strQuestionFunction = "Modify";

                //設定bModify
                if (Session["bModify"] != null)
                {
                    Session["bModify"] = true;
                }
                else
                {
                    Session.Add("bModify", true);
                }
            }

            //加入Session QuestionFunction
            if (Session["QuestionFunction)"] != null)
            {
                Session["QuestionFunction"] = strQuestionFunction;
            }
            else
            {
                Session.Add("QuestionFunction", strQuestionFunction);
            }

            //加入Session ModifyType
            if (Session["ModifyType)"] != null)
            {
                Session["ModifyType"] = "Question";
            }
            else
            {
                Session.Add("ModifyType", "Question");
            }

            //加入QuestionMode
            if (Session["QuestionMode"] != null)
            {
                Session["QuestionMode"] = "General";
            }
            else
            {
                Session.Add("QuestionMode", "General");
            }

            if (rb1.Checked == true)
            {
                // 傳遞Career參數,判斷職業領域  老詹 2014/08/17
                string strCareerID = Request.QueryString["Career"];
                Response.Redirect("./QuestionGroupTree/QGroupTreeNew.aspx?Career=" + strCareerID);
            }
            else if (rb2.Checked == true)
            {
                Response.Redirect("/Hints/AuthoringTool/DiseaseSymptoms/ProblemTypeTree.aspx");
            }
            else if (rb4.Checked == true)
            {
                Response.Redirect("./Feature/VisionOfQuesion.aspx");
            }
            else if (rb5.Checked == true)
            {
                Response.Redirect("./Feature/Paper_Featurevalues.aspx");
            }
            else if (rb6.Checked == true)
            {
                //下列仿照ORCS出考卷設定
                //產生考卷所需的CaseID、PaperID和考卷名稱,要給HINTS的Paper_CaseDivisionSection資料表用
                string strNowTime     = DateTime.Now.ToString("yyyyMMddHHmmss");
                string strCaseID      = usi.UserID + "Case" + strNowTime; //CaseID
                string strSectionName = "考卷(" + strNowTime + ")";
                string strPaperID     = usi.UserID + strNowTime;          //PaperID
                //取得ServerIP
                string ServerIP = (new IPAddress(Dns.GetHostByName(Dns.GetHostName()).AddressList[0].Address)).ToString();
                //開啟選擇題目出處
                string         strURL      = "";
                clsAllSystemDB allSystemDB = new clsAllSystemDB();
                //---------仿照ORCS出考卷作法---------------
                //將取得的CaseID、PaperID和考卷名稱插入Paper_CaseDivisionSection資料表
                string strSQL = " INSERT INTO Paper_CaseDivisionSection (cCaseID , sClinicNum , cSectionName , cPaperID) " +
                                " VALUES ('" + strCaseID + "' , '1'  ,'" + strSectionName + "' , '" + strPaperID + "') ";
                allSystemDB.ExecuteNonQuery(strSQL);
                //新增到資料庫
                strSQL = " INSERT Paper_Header (cPaperID , cPaperName , cTitle , cObjective , cEditMethod ,  cGenerationMethod , cPresentMethod , sTestDuration , cPresentType) " +
                         " VALUES('" + strPaperID + "' , '" + strSectionName + "' , '" + strSectionName + "' , 'General' , 'Author' , 'Edit' , 'All' , '0' , '10') ";
                allSystemDB.ExecuteNonQuery(strSQL);
                //------------------------------------------
                strURL = "http://" + ServerIP + "/HINTS/AuthoringTool/CaseEditor/Paper/Paper_MainPage.aspx?Opener=SelectPaperMode&cCaseID=" + strCaseID + "&cSectionName=" + Server.UrlEncode(strSectionName) + "&cPaperID=" + strPaperID + "&UserID=" + usi.UserID + "&cComeFromActivityName=EditPaper";
                ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script language=JavaScript>window.open('" + strURL + "','WindowOpen','fullscreen=yes, scrollbars=yes');</script>");
            }
            else
            {
                Response.Redirect("/Hints/Flow control/navigator_case.aspx");
            }
        }