public DefectMeterSumTrfWise GetDefectMeterSumTrfWise(string token, string code)
        {
            if (token != secKey)
            {
                return(null);
            }

            DefectMeterSumTrfWise _DefectMeterSumTrfWise = new DefectMeterSumTrfWise();
            utility    util      = new utility();
            DB_Utility objDbuTil = new DB_Utility(conStr);
            DataTable  dt        = objDbuTil.GetDefectMeterSumTrfWise(code, DateTime.Now.AddMonths(-1));

            if (dt != null)
            {
                DataView dv = dt.DefaultView;
                dv.Sort = "CODE DESC";
                DataTable dt1 = dv.ToTable();

                if (dt1 != null)
                {
                    string billMonth = utility.GetColumnValue(dt1.Rows[0], "BILLMONTH");
                    string cd        = utility.GetColumnValue(dt1.Rows[0], "CODE");

                    _DefectMeterSumTrfWise = new DefectMeterSumTrfWise(billMonth, cd, dt1);
                }
            }

            return(_DefectMeterSumTrfWise);
        }
示例#2
0
    public string GetCollVsCompAssmnt(string token, string code = "1")
    {
        string        secKey = System.Configuration.ConfigurationManager.AppSettings["SECKEY"].ToString();
        string        conStr = System.Configuration.ConfigurationManager.ConnectionStrings["CONSTR"].ToString();
        DataTable     dt;
        utility       util       = new utility();
        DB_Utility    objDbuTil  = new DB_Utility(conStr);
        StringBuilder jsonString = new StringBuilder();

        jsonString.Append("[");
        // jsonString.Append(@"{");
        StringBuilder filterExp = new StringBuilder();
        string        ret       = "error";

        if (token != secKey)
        {
            return("Invalid Token.");
        }
        try
        {
            if (!string.IsNullOrEmpty(code))
            {
                filterExp.AppendFormat("LEN(SDIVCODE) >= {0} and LEN(SDIVCODE) <= {1}", (code.Length).ToString(), (code.Length + 1).ToString());
            }

            dt = objDbuTil.GetCollVsCompAssmnt(code);

            if (dt != null)
            {
                int      i  = 0;
                DataView dv = dt.DefaultView;
                dv.RowFilter = filterExp.ToString();
                dv.Sort      = "SRT_ORDER2 ASC";
                foreach (DataRowView dr in dv)
                {
                    util.GetCollVsCompAssmntPJSON1(dv.ToTable(), jsonString, dr["SDIVCODE"].ToString());
                    if (i == dv.ToTable().Rows.Count - 1)
                    {
                        jsonString.Append("}");
                    }
                    else
                    {
                        jsonString.Append("},");
                    }

                    i++;
                }
            }

            jsonString.Append("]");
            ret = jsonString.ToString();
        }
        catch (Exception ex)
        {
            ret = ex.ToString();
        }

        return(ret);
    }
示例#3
0
    private utility get_util()
    {
        utility my_util = new utility();

        my_util.set_file_name(Application.persistentDataPath + "\\test\\");

        return(my_util);
    }
示例#4
0
    public string insertFilesData(NewsFilesData dataInsert)
    {
        string          response   = "";
        utility         utlObj     = new utility();
        Status_Variable status_var = new Status_Variable();

        /*  เพิ่มข้อมูลไฟล์ */

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle();

        string sql = "";

        sql = "Insert Into NEWS_FILES(FILES_ID,FILES_NAME,FILES_EXT,FILES_SIZE) Values('" + dataInsert.Files_ID + "','" + dataInsert.Files_Name + "','" + dataInsert.Files_Ext + "'," + dataInsert.Files_Size + ")";

        oracleObj.InsertCommand = sql;

        UserLoginData login_data = (UserLoginData)HttpContext.Current.Session["login_data"];

        // ======== Log ========
        LogData log_data = new LogData();

        log_data.ModuleCode = new LogData().Module_News;
        log_data.Username   = login_data.User_ID;
        log_data.Message    = "Add FileData with:" + dataInsert.Files_ID;
        // =====================

        try
        {
            if (oracleObj.Insert() == 1)
            {
                response = "OK";
                // === Log ===
                log_data.StatusCode = log_data.LogStatus_SUCCESS;
                // ===========
            }
            else
            {
                // === Log ===
                log_data.StatusCode = log_data.LogStatus_FAILED;
                // ===========
            }
        }
        catch (Exception e)
        {
            // === Log ===
            log_data.StatusCode = log_data.LogStatus_ERROR;
            log_data.Message   += " [" + e.ToString() + "]";
            // ===========
            HttpContext.Current.Session["response"] = "Unit Test:News:insertFilesData" + " ไม่สามารถดำเนินการได้";
            HttpContext.Current.Response.Redirect("err_response.aspx");
        }

        /* ========= */
        new Log().WriteLog(log_data);

        return(response);
    }
示例#5
0
    private string getCheckDigit(string student_id)
    {
        string  checkdigit = "";
        utility utlObj     = new utility();

        //checkdigit = utlObj.Mod11CheckDigit(student_id);
        checkdigit = utlObj.NationIDCheckDigit(student_id);
        return(checkdigit);
    }
示例#6
0
    protected void btnSAVE_Click(object sender, EventArgs e)
    {
        utility utlObj = new utility();
        uint    chknum;

        txtROOM_CODE.Text     = utlObj.removeAllQuotes(txtROOM_CODE.Text);
        txtROOM_THAINAME.Text = utlObj.removeAllQuotes(txtROOM_THAINAME.Text);
        txtROOM_ENGNAME.Text  = utlObj.removeAllQuotes(txtROOM_ENGNAME.Text);

        if ((txtROOM_CODE.Text.Length < 1) || (txtROOM_CODE.Text.Length > 6))
        {
            MsgValidate("โปรดระบุ รหัสห้องเรียน");
        }
        else if (txtROOM_THAINAME.Text.Length <= 0)
        {
            MsgValidate("โปรดระบุ ชื่อห้องเรียน (ภาษาไทย)");
        }
        else if (txtROOM_ENGNAME.Text.Length <= 0)
        {
            MsgValidate("โปรดระบุ ชื่อห้องเรียน (ภาษาอังกฤษ)");
        }
        else if (!uint.TryParse(txtROOM_CAPACITY.Text, out chknum))
        {
            MsgValidate("โปรดระบุ ความจุห้องเรียนเป็นตัวเลขเท่านั้น");
        }
        else if (ddlBUILDING_CODE.SelectedValue == "0")
        {
            MsgValidate("โปรดระบุ อาคาร");
        }
        else
        {
            room_data.Room_Code        = txtROOM_CODE.Text;
            room_data.Room_ThaiName    = txtROOM_THAINAME.Text;
            room_data.Room_EngName     = txtROOM_ENGNAME.Text;
            room_data.RoomType_Code    = ddlROOM_TYPE_CODE.SelectedValue;
            room_data.Room_CAPACITY    = Convert.ToInt16(txtROOM_CAPACITY.Text);
            room_data.Building_Code    = ddlBUILDING_CODE.SelectedValue;
            room_data.Campus_Code      = ddlCampus.SelectedValue;
            room_data.Faculty_Code     = ddlFACULTY_CODE.SelectedValue;
            room_data.Department_Code  = ddlDEPARTMENT_CODE.SelectedValue;
            room_data.Affiation_Code   = ddlAFFIATION_CODE.SelectedValue;
            room_data.Room_Status      = ddlROOM_STATUS.SelectedValue;
            room_data.Parent_Room_Code = "0";

            string result = new Room().insertRoom(room_data);
            if (result == "OK")
            {
                divSuccess.Visible = true;
                showDiv.Visible    = false;
            }
            else
            {
                MsgValidate("ไม่สามารถเพิ่มห้องเรียนได้ กรุณาทำใหม่อีกครั้ง");
            }
        }
    }
示例#7
0
    protected void btnSAVE_Click(object sender, EventArgs e)
    {
        utility  utlObj = new utility();
        DateTime dt;

        if (ddlDepartment.SelectedItem.Value == "0")
        {
            MsgValidate("โปรดระบุ ภาควิชา");
        }
        else if (!DateTime.TryParseExact(txtStartDate.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dt))
        {
            MsgValidate("รูปแบบวันเริ่มต้นการจัดตาราสอน/ตาราสอบ วัน/เดือน/ปี เช่น 01/10/2015");
        }
        else if (!DateTime.TryParseExact(txtStopDate.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dt))
        {
            MsgValidate("รูปแบบวันสุดท้ายการจัดตาราสอน/ตาราสอบ วัน/เดือน/ปี เช่น 01/10/2015");
        }
        else if (utlObj.getDiffDate(txtStartDate.Text, txtStopDate.Text) > 0)
        {
            MsgValidate("วันเริ่มแรกและวันสุดท้ายของการขึ้นทะเบียน ไม่สอดคล้องกัน");
        }
        else
        {
            string result = "";
            config_data.Faculty_Code    = ddlFACULTY.SelectedItem.Value;
            config_data.Department_Code = ddlDepartment.SelectedItem.Value;
            config_data.Date_Start      = txtStartDate.Text;
            config_data.Date_Stop       = txtStopDate.Text;

            configData = new TeachExamConfig().getExtendTeachExamConfig(ddlDepartment.SelectedItem.Value);

            if (configData.Department_Code == null)
            {
                result          = new TeachExamConfig().extendDateConfig(config_data);
                lblSuccess.Text = "เพิ่มข้อมูลสำเร็จ";
            }
            else
            {
                config_data.Department_Code = configData.Department_Code;
                result          = new TeachExamConfig().updateExtendDateConfig(config_data);
                lblSuccess.Text = "แก้ไขข้อมูลสำเร็จ";
            }

            if (result == "OK")
            {
                success.Visible = true;
                fail.Visible    = false;
            }
            else
            {
                success.Visible = false;
                fail.Visible    = true;
            }
        }
    }
示例#8
0
    /**
     * @brief テスト用のファイル名を取得
     * @return string ファイル名
     * @details 特になし
     */
    private string get_test_file_name(bool isDisplayFileName = false)
    {
        utility my_util = get_util();

        if (isDisplayFileName)
        {
            Debug.Log("テスト用ファイル");
            Debug.Log(Application.persistentDataPath);
        }
        return(my_util.get_file_name());
    }
示例#9
0
    private void delete_test_folder()
    {
        utility my_util = get_util();

        //ファイルを削除
        FileInfo file = new FileInfo(my_util.get_file_name());

        file.Delete();

        //フォルダを削除
    }
	// Use this for initialization
	void Start () {
		utility my_util = new utility ();
		my_util.set_file_name (Application.persistentDataPath);
		m_file_name = my_util.get_file_name ();

		content = GetComponent<RectTransform> ();

		my_task_list = new task_list ();
		my_task_list.init (m_file_name);

		renew_item ();
	}
        public ActionResult DropDown()
        {
            PartsViewModel partsViewModel = new PartsViewModel();

            //Get list of options
            utility utility     = new utility();
            var     sortOptions = utility.GetOptions();

            //DropDownList property of view model will contain a list of all options.
            partsViewModel.DropDownList = utility.SetOptions(sortOptions);

            return(View(partsViewModel));
        }
示例#12
0
    private string thaiduedate(char[] engdate)
    {
        string  thaidate = "";
        utility utilObj  = new utility();

        string isday   = new string(engdate, 0, 2);
        string ismonth = new string(engdate, 2, 2);
        string isyear  = "20" + new string(engdate, 4, 2);

        thaidate = isday + " " + utilObj.getThaiMonth(ismonth) + " " + utilObj.getThaiYear(isyear);

        return(thaidate);
    }
示例#13
0
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        BuildingData update_data = new BuildingData();

        utility utlObj = new utility();
        uint    chknum;

        txtBUILDING_THAINAME.Text  = utlObj.removeAllQuotes(txtBUILDING_THAINAME.Text);
        txtBUILDING_ENGNAME.Text   = utlObj.removeAllQuotes(txtBUILDING_ENGNAME.Text);
        txtBUILDING_SHORTNAME.Text = utlObj.removeAllQuotes(txtBUILDING_SHORTNAME.Text);

        if (txtBUILDING_CODE.Text.Length != 2)
        {
            MsgValidate("โปรดระบุ รหัสอาคารด้วยตัวเลข 2 หลัก");
        }
        else if (!uint.TryParse(txtBUILDING_CODE.Text, out chknum))
        {
            MsgValidate("โปรดระบุ รหัสอาคารเป็นตัวเลขเท่านั้น");
        }
        else if (txtBUILDING_THAINAME.Text.Length <= 0)
        {
            MsgValidate("โปรดระบุ ชื่ออาคาร (ภาษาไทย)");
        }
        else if (txtBUILDING_ENGNAME.Text.Length <= 0)
        {
            MsgValidate("โปรดระบุ ชื่ออาคาร (ภาษาอังกฤษ)");
        }
        else if (txtBUILDING_SHORTNAME.Text.Length <= 0)
        {
            MsgValidate("โปรดระบุ ชื่อย่ออาคาร");
        }
        else
        {
            update_data.Building_Code      = txtBUILDING_CODE.Text;
            update_data.Building_ThaiName  = txtBUILDING_THAINAME.Text;
            update_data.Building_EngName   = txtBUILDING_ENGNAME.Text;
            update_data.Building_ShortName = txtBUILDING_SHORTNAME.Text;
            update_data.Campus_Code        = ddlCAMPUS.SelectedValue;

            string result = new Building().updateBuilding(update_data, Request.QueryString["campus"]);

            if (result == "OK")
            {
                divSuccess.Visible = true;
            }
            else
            {
                MsgValidate("ไม่สามารถดำเนินการได้");
            }
        }
    }
示例#14
0
        // 否则用方法二(穷举)
        #else
        public utility UtilityTest(string pGame)
        {
            utility utility = utility.Draw;             //缺省为平局

            char[] aGame;
            aGame = pGame.ToCharArray();

            // 最上面三个相同(水平)
            if (aGame[0].Equals(aGame[1]) & aGame[0].Equals(aGame[2]) & !aGame[0].Equals(' '))
            {
                utility = aGame[0].Equals(machineChar) ? utility.MaxWin : utility.MinWin;
            }
            // 中间三个相同(水平)
            if (aGame[3].Equals(aGame[4]) & aGame[3].Equals(aGame[5]) & !aGame[3].Equals(' '))
            {
                utility = aGame[3].Equals(machineChar) ? utility.MaxWin : utility.MinWin;
            }
            // 最下面三个相同(水平)
            if (aGame[6].Equals(aGame[7]) & aGame[6].Equals(aGame[8]) & !aGame[6].Equals(' '))
            {
                utility = aGame[6].Equals(machineChar) ? utility.MaxWin : utility.MinWin;
            }
            // 最左边三个相同(垂直)
            if (aGame[0].Equals(aGame[3]) & aGame[0].Equals(aGame[6]) & !aGame[0].Equals(' '))
            {
                utility = aGame[0].Equals(machineChar) ? utility.MaxWin : utility.MinWin;
            }
            // 中间三个相同(垂直)
            if (aGame[1].Equals(aGame[4]) & aGame[1].Equals(aGame[7]) & !aGame[1].Equals(' '))
            {
                utility = aGame[1].Equals(machineChar) ? utility.MaxWin : utility.MinWin;
            }
            // 右边三个相同(垂直)
            if (aGame[2].Equals(aGame[5]) & aGame[2].Equals(aGame[8]) & !aGame[2].Equals(' '))
            {
                utility = aGame[2].Equals(machineChar) ? utility.MaxWin : utility.MinWin;
            }
            // 对角线三个相同(左上到右下)
            if (aGame[0].Equals(aGame[4]) & aGame[0].Equals(aGame[8]) & !aGame[0].Equals(' '))
            {
                utility = aGame[0].Equals(machineChar) ? utility.MaxWin : utility.MinWin;
            }
            // 对角线三个相同(右上到左下)
            if (aGame[2].Equals(aGame[4]) & aGame[2].Equals(aGame[6]) & !aGame[2].Equals(' '))
            {
                utility = aGame[2].Equals(machineChar) ? utility.MaxWin : utility.MinWin;
            }

            return(utility);
        }
示例#15
0
        public BillStatsContainer GetBillingStatsBatchWise(string token, string code)
        {
            DataTable     dtD, dtB;
            utility       util      = new utility();
            DB_Utility    objDbuTil = new DB_Utility(conStr);
            StringBuilder filterExp = new StringBuilder();

            if (token != secKey)
            {
                return(null);
            }

            if (!string.IsNullOrEmpty(code))
            {
                filterExp.AppendFormat("LEN(CODE) >= {0} and LEN(CODE) <= {1}", (code.Length).ToString(),
                                       (code.Length + 1).ToString());
            }

            dtD = objDbuTil.getBillingStatsDaily(code, DateTime.Now.AddMonths(-1));
            dtB = objDbuTil.getBillingStatsBatchWise(code, DateTime.Now.AddMonths(-1));

            if (dtD != null)
            {
                DataView dvD = dtD.DefaultView;
                dvD.RowFilter = filterExp.ToString();
                dvD.Sort      = "SRT_ORDER2 ASC";

                DataView dvB = dtB.DefaultView;
                dvB.RowFilter = filterExp.ToString();
                dvB.Sort      = "SRT_ORDER2 ASC";


                BillStatsContainer billStContainer = new BillStatsContainer(code, dvD.ToTable(), dvB.ToTable());
                return(billStContainer);


                //foreach (DataRowView dr in dv)
                //{
                //    string cd = utility.GetColumnValue(dr, "CODE");
                //    string name = utility.GetColumnValue(dr, "NAME");
                //    string month = utility.GetColumnValue(dr, "MONTH");
                //    bStats.Add(new BillingStats(month,cd,name,dv.ToTable()));

                //}
            }

            return(null);
        }
示例#16
0
        private utility minimaxValueSuccesors(out ArrayList pOperator, string pGame, bool pMaxTurn, ArrayList pOperators)
        {
            utility   value;
            utility   maxValue = utility.MinWin;
            utility   minValue = utility.MaxWin;
            ArrayList bestOps  = new ArrayList();
            ArrayList worstOps = new ArrayList();
            ArrayList operatorsLeft;
            string    workingGame;

            // Loop for all operators. If pMaxTurn return highest, else return lowest
            foreach (int lOperator in pOperators)
            {
                // Apply the operator to the game
                workingGame   = ApplyMove(lOperator, pGame, pMaxTurn);
                operatorsLeft = (ArrayList)pOperators.Clone();
                operatorsLeft.Remove(lOperator);
                value = minimaxValueForState(workingGame, pMaxTurn, operatorsLeft);

                // If this a new best operator reset the ArrayList
                if (value > maxValue)
                {
                    bestOps = new ArrayList();
                }
                // Should we add this operator to our list
                if (value >= maxValue)
                {
                    bestOps.Add(lOperator);
                    maxValue = value;
                }

                // If this a new worst operator reset the ArrayList
                if (value < minValue)
                {
                    worstOps = new ArrayList();
                }
                // Should we add this operator to our list
                if (value <= minValue)
                {
                    worstOps.Add(lOperator);
                    minValue = value;
                }
            }

            pOperator = pMaxTurn ? bestOps : worstOps;                  // 'out' the relevant ArrayList
            return(pMaxTurn ? maxValue : minValue);                     // return the utility
        }
示例#17
0
    /// <summary>
    /// เพิ่มข้อมูลลงตาราง TQF2SEC3PLANDETAIL
    /// </summary>
    /// <param name="dataInsert">TQF2Sec3PlanDetail Object</param>
    /// <returns>Success</returns>
    public string insertTQF2Sec3PlanDetail(TQF2Sec3PlanDetail dataInsert)
    {
        string response = "";

        int    sleepTime = 5000;
        string T2S3No    = dataInsert.T2S3No;

        for (int i = 0; i < 10; i++)
        {
            if (getTQF2Sec3PlanDetail(T2S3No).T2S3No != null)
            {
                Thread.Sleep(sleepTime);
                T2S3No     = new utility().getMaxID("T2S3NO", "TQF2SEC3PLANDETAIL");
                sleepTime += 5000;
            }
            else
            {
                dataInsert.T2S3No = T2S3No;
                break;
            }
        }

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        string sql = "Insert into TQF2SEC3PLANDETAIL (T2S3NO, CURRCODE, YEARVERSION, CURRFORMATCODE, CURRTYPECODE, MAJORCODE, COURSEGROUPCODE, CATEGORYCODE, COURSETYPECODE, COURSECODE, EDUCATIONYEAR, EDUCATIONSEMESTER) values ('" + dataInsert.T2S3No + "','" +
                     dataInsert.CurrCode + "','" + dataInsert.YearVersion + "','" + dataInsert.CurrFormatCode + "','" + dataInsert.CurrTypeCode + "','" + dataInsert.MajorCode + "','" + dataInsert.CourseGroupCode + "','" + dataInsert.CategoryCode + "','" + dataInsert.CourseTypeCode + "','" + dataInsert.CourseCode + "','" + dataInsert.EducationYear + "','" + dataInsert.EducationSemester + "')";

        oracleObj.InsertCommand = sql;

        try
        {
            if (oracleObj.Insert() == 1)
            {
                response = "Success";
            }
        }
        catch (Exception e)
        {
            string exception = e.Message;
            HttpContext.Current.Session["response"] = "insertTQF2Sec3PlanDetail: " + exception;
            HttpContext.Current.Response.Redirect("../err_response.aspx");
        }

        return(response);
    }
示例#18
0
    /// <summary>
    /// เพิ่มข้อมูลลงตาราง DIPLOMA
    /// </summary>
    /// <param name="dataInsert">Diploma Object</param>
    /// <returns>Success</returns>
    public string insertDiploma(Diploma dataInsert)
    {
        string response = "";

        int    sleepTime   = 5000;
        string DiplomaCode = dataInsert.DiplomaCode;

        for (int i = 0; i < 10; i++)
        {
            if (getDiploma(DiplomaCode).DiplomaCode != null)
            {
                Thread.Sleep(sleepTime);
                DiplomaCode = new utility().getMaxID("DIPLOMACODE", "DIPLOMA");
                sleepTime  += 5000;
            }
            else
            {
                dataInsert.DiplomaCode = DiplomaCode;
                break;
            }
        }

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        string sql = "Insert into DIPLOMA (YEARVERSION, DIPLOMACODE, CURRCODE, DOMAINTHNAME, DOMAINENNAME, DOMAINTHSHORTNAME, DOMAINENSHORTNAME) values ('" + dataInsert.YearVersion + "','" + dataInsert.DiplomaCode + "','" + dataInsert.CurrCode + "','" + dataInsert.DomainThName + "','" + dataInsert.DomainEnName + "','" + dataInsert.DomainThShortName + "','" + dataInsert.DomainEnShortName + "')";

        oracleObj.InsertCommand = sql;

        try
        {
            if (oracleObj.Insert() == 1)
            {
                response = "Success";
            }
        }
        catch (Exception e)
        {
            string exception = e.Message;
            HttpContext.Current.Session["response"] = "insertDiploma: " + exception;
            HttpContext.Current.Response.Redirect("../err_response.aspx");
        }

        return(response);
    }
示例#19
0
    /// <summary>
    /// เพิ่มข้อมูลลงตาราง COURSEELECTIVEMEMBER
    /// </summary>
    /// <param name="dataInsert">CourseElectiveMember Object</param>
    /// <returns>Success</returns>
    public string insertCourseElectiveMember(CourseElectiveMember dataInsert)
    {
        string response = "";

        int    sleepTime = 5000;
        string CourseElectiveMemberCode = dataInsert.CourseElectiveMemberCode;

        for (int i = 0; i < 10; i++)
        {
            if (getCourseElectiveMemberCode(CourseElectiveMemberCode).CourseElectiveMemberCode != null)
            {
                Thread.Sleep(sleepTime);
                CourseElectiveMemberCode = new utility().getMaxID("COURSEELECTIVEMEMBERCODE", "COURSEELECTIVEMEMBER");
                sleepTime += 5000;
            }
            else
            {
                dataInsert.CourseElectiveMemberCode = CourseElectiveMemberCode;
                break;
            }
        }

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        string sql = "Insert into COURSEELECTIVEMEMBER (COURSEELECTIVEMEMBERCODE, COURSECODE, COURSEELECTIVECODE, FACULTYCODE, FACULTYOWNER) values ('" + dataInsert.CourseElectiveMemberCode + "','" + dataInsert.CourseCode + "','" + dataInsert.CourseElectiveCode + "','" + dataInsert.FacultyCode + "','" + dataInsert.FacultyOwner + "')";

        oracleObj.InsertCommand = sql;

        try
        {
            if (oracleObj.Insert() == 1)
            {
                response = "Success";
            }
        }
        catch (Exception e)
        {
            string exception = e.Message;
            HttpContext.Current.Session["response"] = "insertCourseElectiveMember: " + exception;
            HttpContext.Current.Response.Redirect("../err_response.aspx");
        }

        return(response);
    }
示例#20
0
    /// <summary>
    /// เพิ่มข้อมูลลงตาราง ABOUTLECTURER
    /// </summary>
    /// <param name="dataInsert">AboutLecturer Object</param>
    /// <returns>Success</returns>
    public string insertAboutLecturer(AboutLecturer dataInsert)
    {
        string response = "";

        int    sleepTime = 5000;
        string Sequence  = dataInsert.Sequence;

        for (int i = 0; i < 10; i++)
        {
            if (getAboutLecturer(Sequence).Sequence != null)
            {
                Thread.Sleep(sleepTime);
                Sequence   = new utility().getMaxID("SEQUENCE", "ABOUTLECTURER");
                sleepTime += 5000;
            }
            else
            {
                dataInsert.Sequence = Sequence;
                break;
            }
        }

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        string sql = "Insert into ABOUTLECTURER (CURRCODE, YEARVERSION, LECTIDENTITY, LOADTYPECODE, SEQUENCE, MAJORCODE) values ('" + dataInsert.CurrCode + "','" + dataInsert.YearVersion + "','" + dataInsert.LectIdentity + "','" + dataInsert.LoadTypeCode + "','" + dataInsert.Sequence + "','" + dataInsert.MajorCode + "')";

        oracleObj.InsertCommand = sql;

        try
        {
            if (oracleObj.Insert() == 1)
            {
                response = "Success";
            }
        }
        catch (Exception e)
        {
            string exception = e.Message;
            HttpContext.Current.Session["response"] = "insertAboutLecturer: " + exception;
            HttpContext.Current.Response.Redirect("../err_response.aspx");
        }

        return(response);
    }
        public ActionResult DropDown(PartsViewModel partsViewModel)
        {
            if (ModelState.IsValid)
            {
                {
                    //'PartsViewModel.DropDownValue' property will contain your selected value
                    //Do your stuff with this value such as DB update, etc
                }

                //Get list of options
                utility utility     = new utility();
                var     sortOptions = utility.GetOptions();

                //DropDownList property of view model will contain a list of all options.
                partsViewModel.DropDownList = utility.SetOptions(sortOptions);
            }
            return(View(partsViewModel));
        }
示例#22
0
        public Bill GetBill(string kwh, string trf)
        {
            DataTable  dt;
            utility    util      = new utility();
            DB_Utility objDbuTil = new DB_Utility(conStr);
            Bill       bObj;

            DateTime firstDayOfMonth = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            DateTime lastDayOfMonth  = firstDayOfMonth.AddMonths(1).AddDays(-1);

            dt = objDbuTil.getBillData("1", kwh, firstDayOfMonth, lastDayOfMonth, trf);

            if (dt != null && dt.Rows.Count > 0)
            {
                return(new Bill(dt.Rows[0]["ENRCHRG"].ToString(), dt.Rows[0]["TR_SUR"].ToString(), "0", "0", "0", "0",
                                "0", "0", "0", dt.Rows[0]["BILLSLABS"].ToString()));
            }

            return(null);
        }
示例#23
0
        public List <AssmntBatchWiseObject> GetAssesmentBatchWise(string token, string code)
        {
            if (token != secKey)
            {
                return(null);
            }

            utility       util                = new utility();
            DB_Utility    objDbuTil           = new DB_Utility(conStr);
            DataTable     dt                  = objDbuTil.getAssesmentBatchWise(code, DateTime.Now.AddMonths(-1));
            StringBuilder filterExp           = new StringBuilder();
            List <AssmntBatchWiseObject> coll = new List <AssmntBatchWiseObject>();

            if (dt != null)
            {
                DataView dv = dt.DefaultView;
                if (!string.IsNullOrEmpty(code))
                {
                    filterExp.AppendFormat("LEN(SDIV_CODE) >= {0} and LEN(SDIV_CODE) <= {1}", (code.Length).ToString(),
                                           (code.Length + 1).ToString());
                }

                dv.RowFilter = filterExp.ToString();
                dv.Sort      = "SRT_ORDER2 ASC";
                DataView  distinctview   = new DataView(dt);
                DataTable distinctValues = distinctview.ToTable(true, "SDIV_CODE", "SDIV_NAME", "MONTH");
                foreach (DataRow dr in distinctValues.Rows)
                {
                    string cd    = utility.GetColumnValue(dr, "SDIV_CODE");
                    string name  = utility.GetColumnValue(dr, "SDIV_NAME");
                    string month = utility.GetFormatedDate(utility.GetColumnValue(dr, "MONTH"));
                    dv.RowFilter = string.Format("SDIV_CODE = '{0}'", cd);
                    DataTable dt1 = dv.ToTable();
                    coll.Add(new AssmntBatchWiseObject(cd, name, month, dt1));
                }
            }

            return(coll);
        }
示例#24
0
    protected void btnEXCEL_Click(object sender, EventArgs e)
    {
        //Export to Excel
        degree_char = ddlDegreeLevel.SelectedValue;
        List <AvailableCourseData> availableData = new AvailableCourse().getAvailableCourse(txtACADEMIC_YEAR.Text, ddlSEMESTER.SelectedValue, txtCOURSE_CODE.Text, degree_char);

        string  fileName = "รายวิชาที่เปิดสอน ภาคการศึกษาที่ " + availableData[0].Semester + "_" + availableData[0].AcademicYear;
        utility utname   = new utility();

        Response.ClearContent();
        Response.AddHeader("content-disposition", "attachment;filename=" + fileName + ".xls");

        Response.ContentType     = "application/vnd.ms-excel";
        Response.ContentEncoding = System.Text.Encoding.Unicode;
        Response.BinaryWrite(System.Text.Encoding.Unicode.GetPreamble());

        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        this.EnableViewState = false;

        //StringWriter sw = new StringWriter();
        //HtmlTextWriter hw = new HtmlTextWriter(sw);

        //panelListAvailableCourse.RenderControl(hw);

        Response.Write(AddExcelStyling());

        string style = @"<style> .textmode {mso-number-format:'\@'} </style>";

        Response.Write(style);

        string table_struct1 = createTableStruct();

        Response.Write(table_struct1);
        Response.Flush();
        Response.End();

        //End Export to Excel
    }
示例#25
0
        public List <CashCollection> GetCashCollSummary(string token, string code)
        {
            if (token != secKey)
            {
                return(null);
            }

            List <CashCollection> coll = new List <CashCollection>();
            utility       util         = new utility();
            DB_Utility    objDbuTil    = new DB_Utility(conStr);
            DataTable     dt           = objDbuTil.GetCashCollSummary(code, DateTime.Now.AddMonths(-1));
            StringBuilder filterExp    = new StringBuilder();

            if (dt != null)
            {
                DataView dv = dt.DefaultView;
                if (!string.IsNullOrEmpty(code))
                {
                    filterExp.AppendFormat("LEN(CODE) >= {0} and LEN(CODE) <= {1}", (code.Length).ToString(),
                                           (code.Length + 1).ToString());
                }

                dv.RowFilter = filterExp.ToString();
                dv.Sort      = "SRT_ORDER2 ASC";
                DataView  distinctview   = new DataView(dt);
                DataTable distinctValues = distinctview.ToTable(true, "CODE", "NAME");
                foreach (DataRow dr in distinctValues.Rows)
                {
                    string cd   = utility.GetColumnValue(dr, "CODE");
                    string name = utility.GetColumnValue(dr, "NAME");
                    dv.RowFilter = string.Format("CODE = '{0}'", cd);
                    DataTable dt1 = dv.ToTable();
                    coll.Add(new CashCollection(cd, name, dt1));
                }
            }

            return(coll);
        }
示例#26
0
        public static string GetBillingStatus(string token)
        {
            string ret = "Error";

            if (token != secKey)
            {
                return("Ivalid Token.");
            }
            try
            {
                DB_Utility objDBUTil = new DB_Utility(conStr);
                DataTable  dt        = objDBUTil.getBillingStatus();
                utility    util      = new utility();

                ret = util.DataTableToJSONWithStringBuilder(dt);
            }
            catch (Exception ex)
            {
                ret = ex.ToString();
            }

            return(ret);
        }
示例#27
0
        public List <FeederLosses> GetFeederLosses(string token)
        {
            if (token != secKey)
            {
                return(null);
            }

            List <FeederLosses> coll      = new List <FeederLosses>();
            utility             util      = new utility();
            DB_Utility          objDbuTil = new DB_Utility(conStr);
            DataTable           dt        = objDbuTil.GetFeederLosses(DateTime.Now.AddMonths(-1));
            StringBuilder       filterExp = new StringBuilder();

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    coll.Add(new FeederLosses(dr));
                }
            }

            return(coll);
        }
示例#28
0
    protected void btnSAVE_Click(object sender, EventArgs e)
    {
        utility utlObj = new utility();

        txtWork_Position_Thai.Text = utlObj.removeAllQuotes(txtWork_Position_Thai.Text);
        txtWork_Position_Eng.Text  = utlObj.removeAllQuotes(txtWork_Position_Eng.Text);

        if (txtWork_Position_Thai.Text.Length <= 0 || txtWork_Position_Thai.Text.Length > 50)
        {
            MsgValidate("โปรดระบุ ชื่อตำแหน่งาน (ภาษาไทย)");
        }
        else if (txtWork_Position_Eng.Text.Length <= 0 || txtWork_Position_Eng.Text.Length > 50)
        {
            MsgValidate("โปรดระบุ ชื่อตำแหน่งาน (ภาษาอังกฤษ)");
        }
        else
        {
            BoardPosData update_data = new BoardPosData();

            update_data.Position_Thai = txtWork_Position_Thai.Text;
            update_data.Position_Eng  = txtWork_Position_Eng.Text;
            update_data.Status        = ddlStatus.SelectedValue;
            update_data.Position_Code = Request.QueryString["position"];

            string result = new BoardPos().updateBoardPos(update_data);

            if (result == "OK")
            {
                divSuccess.Visible = true;
                showDiv.Visible    = false;
            }
            else
            {
                MsgValidate("ไม่สามารถตำแหน่งงานบริหาร กรุณาทำใหม่อีกครั้ง");
            }
        }
    }
示例#29
0
        // 如果用方法一(正则表达式)
        #if RegExp
        public utility UtilityTest(string pGame)
        {
            utility utility           = utility.Draw;   // 缺省为平局
            string  regularExpression = "WWW......|...WWW...|......WWW|W..W..W..|.W..W..W.|..W..W..W|W...W...W|..W.W.W..";
            string  regexTest;

            // 机器赢了吗?
            regexTest = pGame.Replace(machineChar, 'W');
            if (Regex.IsMatch(regexTest, regularExpression))
            {
                utility = utility.MaxWin;
            }
            else
            {
                // 人赢了吗?
                regexTest = pGame.Replace(userChar, 'W');
                if (Regex.IsMatch(regexTest, regularExpression))
                {
                    utility = utility.MinWin;
                }
            }

            return(utility);
        }
示例#30
0
    public string GetBillStatus(string token)
    {
        string secKey = System.Configuration.ConfigurationManager.AppSettings["SECKEY"].ToString();
        string conStr = System.Configuration.ConfigurationManager.ConnectionStrings["CONSTR"].ToString();
        string ret    = "Error";

        if (token != secKey)
        {
            return("Ivalid Token.");
        }
        try
        {
            DB_Utility objDBUTil = new DB_Utility(conStr);
            DataTable  dt        = objDBUTil.getBillingStatus();
            utility    util      = new utility();

            ret = util.DataTableToJSONWithStringBuilder(dt);
        }
        catch (Exception ex)
        {
            ret = ex.ToString();
        }
        return(ret);
    }