Ejemplo n.º 1
0
 public void BDToXML(String sql ,String nombreNodo,String nombreFicheroXML)
 {
     ConnectDB conexion = new ConnectDB();
     DataSet data = conexion.getData(sql, nombreNodo);
     data.WriteXml(nombreFicheroXML);
     MessageBox.Show("Fichero XML creado con éxito");
 }
Ejemplo n.º 2
0
        //Metodo para rellenar combobox con una consulta de dos valores, el primero oculto y el segundo visible
        //
        //combo -> Combobox a rellenar
        //consulta -> Consulta SQL para obtener los valores
        //inicio -> Primer elemento del combo (Seleccione ...). Si no se desea inicio introducir ""
        //
        //
        //Metodos para extraer los elementos del combobox
        //
        //Elem oculto = cboCombo.SelectedValue()
        //Nombre de la columna visible = cboCombo.DisplayMember()
        //Posicion del seleccionado = cboCombo.SelectedIndex)
        //
        public void rellenacombobox(ComboBox combo, String consulta,String inicio)
        {
            DataSet Data = new DataSet();
            ConnectDB Search = new ConnectDB();

            Data = Search.getData(consulta, "tabla");
            DataTable ttablas = Data.Tables["tabla"];
            if (!inicio.Equals(""))
            {
                DataRow newrow2 = ttablas.NewRow();
                newrow2[0] = -1;
                newrow2[1] = inicio;
                ttablas.Rows.InsertAt(newrow2, 0);
            }
            combo.DataSource = ttablas;
                combo.DisplayMember = ttablas.Columns[1].ToString();
                combo.ValueMember = ttablas.Columns[0].ToString();
        }
 public CategoryNewsController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
        protected void Create_Click(object sender, EventArgs e)
        {
            string id        = Request.QueryString["ID"];
            string DroneID   = this.DropDownListDroneID.SelectedValue;
            string date      = this.TextDate.Text;
            string staff     = this.TextStaff.Text;
            string battery   = this.TextBattery.Text;
            string customer  = this.TextCustomerName.Text;
            string tel       = this.TextCustomerTel.Text;
            string address   = this.TextCustomerAddres.Text;
            string remarks   = this.TextRemarks.Text;
            bool   canSubmit = false;

            if (date == "")
            {
                this.errorMsgDate.Visible = true;
            }

            if (staff == "")
            {
                this.errorMsgStaff.Visible = true;
            }

            if (battery == "")
            {
                this.errorMsgBattery.Visible = true;
            }

            if (customer == "")
            {
                this.errorMsgCustomerName.Visible = true;
            }

            if (tel == "")
            {
                this.errorMsgCustomerTel.Visible = true;
            }

            if (address == "")
            {
                this.errorMsgCustomerAddress.Visible = true;
            }



            if (date != "" && staff != "" && battery != "" && customer != "" && tel != "" && address != "")
            {
                canSubmit = true;
            }

            if (canSubmit)
            {
                if (id == null)
                {
                    ConnectDB.InsertIntoDroneDestination(date, staff, DroneID, battery, customer, tel, address, remarks);
                }

                if (id != null)
                {
                    ConnectDB.UpDateDroneDestination(id, date, staff, DroneID, battery, customer, tel, address, remarks);
                }
                Response.Redirect("Drone_Destination.aspx");
            }
        }
Ejemplo n.º 5
0
 public TCallDB(ConnectDB c)
 {
     conn = c;
     initConfig();
 }
 public testController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
Ejemplo n.º 7
0
    // V1.0.0
    public string insertConfig(StudentIDConfigData insertData)
    {
        string response = "";

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

        try
        {
            // เพิ่มข้อมูลต้องมี Gen_Type แบบเดียวกัน
            oracleObj.SelectCommand = "Select *  From STUDENT_ID_CONFIG Where  FACULTY_CODE='" + insertData.Faculty_Code + "' And DEPARTMENT_CODE='" + insertData.Department_Code + "' And MAJOR_CODE='" + insertData.Major_Code + "' And DEGREE_ADMISSION='" + insertData.Degree_Admission + "'";
            DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

            if (allData.Count != 0)
            {
                if (allData[0]["Gen_Type"].ToString() != "0")
                {
                    response = "รหัสนักศึกษาหลักที่ 10 ถูกกำหนดรูปแบบ (ไม่ใช้หมายเลข) ไว้ก่อนแล้ว";
                }
                else if (insertData.Gen_Type != "0")
                {
                    response = "รหัสนักศึกษาหลักที่ 10 ถูกกำหนดรูปแบบ (ใช้หมายเลข) ไว้ก่อนแล้ว";
                }

                else
                {
                    oracleObj.SelectCommand = "Select *  From STUDENT_ID_CONFIG Where  FACULTY_CODE='" + insertData.Faculty_Code + "' And DEPARTMENT_CODE='" + insertData.Department_Code + "' And MAJOR_CODE='" + insertData.Major_Code + "' And DEGREE_ADMISSION='" + insertData.Degree_Admission + "' And ADMISSION_TYPE='" + insertData.Admission_Type + "' AND SEC_NO='" + insertData.Sec_No + "' AND PROJECT_CODE='" + insertData.Project_Code + "'";
                    DataView allData2 = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
                    if (allData2.Count > 0)
                    {
                        response = "ไม่สามารถกำหนด หมายเลขห้อง โดยใช้โครงการซ้ำซ้อนได้";
                    }
                    else
                    {
                        oracleObj.SelectCommand = "Select NUM_OF_STUDENT  From STUDENT_ID_CONFIG Where  FACULTY_CODE='" + insertData.Faculty_Code + "' And DEPARTMENT_CODE='" + insertData.Department_Code + "' And MAJOR_CODE='" + insertData.Major_Code + "' And DEGREE_ADMISSION='" + insertData.Degree_Admission + "' AND SEC_NO='" + insertData.Sec_No + "'";
                        DataView allData3 = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

                        if (allData3.Count > 0)
                        {
                            if (insertData.num_of_student != Convert.ToUInt32(allData3[0]["NUM_OF_STUDENT"].ToString()))
                            {
                                response = "จำนวนนักศึกษา ถูกกำหนดไว้แล้ว คือ " + allData3[0]["NUM_OF_STUDENT"].ToString() + " คน";
                            }
                            else
                            {
                                oracleObj.SelectCommand = "SELECT CONFIG_STD_ID_SEQ.NEXTVAL FROM DUAL";
                                DataView seq     = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
                                int      nextval = Convert.ToInt32(seq[0]["NEXTVAL"]);

                                oracleObj.InsertCommand = "Insert Into STUDENT_ID_CONFIG(ID,FACULTY_CODE, DEPARTMENT_CODE, MAJOR_CODE, DEGREE_ADMISSION, ADMISSION_TYPE, GEN_TYPE, SEC_NO, PROJECT_CODE,PROJECT_SELECTED,MAJOR_STUDENT_ID,NUM_OF_STUDENT) Values(" + seq[0]["NEXTVAL"].ToString() + ",'" + insertData.Faculty_Code + "','" + insertData.Department_Code + "','" + insertData.Major_Code + "','" + insertData.Degree_Admission + "','" + insertData.Admission_Type + "','" + insertData.Gen_Type + "','" + insertData.Sec_No + "','" + insertData.Project_Code + "','" + insertData.Project_Selected + "','" + insertData.Major_Student_ID + "'," + insertData.num_of_student + ")";

                                if (oracleObj.Insert() == 1)
                                {
                                    response = "OK";
                                }
                            }
                        }
                        else
                        {
                            oracleObj.SelectCommand = "SELECT CONFIG_STD_ID_SEQ.NEXTVAL FROM DUAL";
                            DataView seq     = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
                            int      nextval = Convert.ToInt32(seq[0]["NEXTVAL"]);

                            oracleObj.InsertCommand = "Insert Into STUDENT_ID_CONFIG(ID,FACULTY_CODE, DEPARTMENT_CODE, MAJOR_CODE, DEGREE_ADMISSION, ADMISSION_TYPE, GEN_TYPE, SEC_NO, PROJECT_CODE,PROJECT_SELECTED,MAJOR_STUDENT_ID,NUM_OF_STUDENT) Values(" + seq[0]["NEXTVAL"].ToString() + ",'" + insertData.Faculty_Code + "','" + insertData.Department_Code + "','" + insertData.Major_Code + "','" + insertData.Degree_Admission + "','" + insertData.Admission_Type + "','" + insertData.Gen_Type + "','" + insertData.Sec_No + "','" + insertData.Project_Code + "','" + insertData.Project_Selected + "','" + insertData.Major_Student_ID + "'," + insertData.num_of_student + ")";

                            if (oracleObj.Insert() == 1)
                            {
                                response = "OK";
                            }
                        }
                    }
                }
            }
            else
            {
                oracleObj.SelectCommand = "Select *  From STUDENT_ID_CONFIG Where  FACULTY_CODE='" + insertData.Faculty_Code + "' And DEPARTMENT_CODE='" + insertData.Department_Code + "' And DEGREE_ADMISSION='" + insertData.Degree_Admission + "' AND MAJOR_STUDENT_ID='" + insertData.Major_Student_ID + "'";
                DataView allData4 = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

                if (allData4.Count != 0)
                {
                    if (allData4[0]["Gen_Type"].ToString() != insertData.Gen_Type)
                    {
                        response = "สาขาวิชานี้ ไม่สามารถเปลี่ยนรูปแบบการแบ่งห้องเรียนได้อีก";
                    }
                    else
                    {
                        oracleObj.SelectCommand = "Select NUM_OF_STUDENT  From STUDENT_ID_CONFIG Where  FACULTY_CODE='" + insertData.Faculty_Code + "' And DEPARTMENT_CODE='" + insertData.Department_Code + "' And DEGREE_ADMISSION='" + insertData.Degree_Admission + "' AND MAJOR_STUDENT_ID='" + insertData.Major_Student_ID + "' AND SEC_NO='" + insertData.Sec_No + "'";
                        DataView allData5 = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
                        if (allData5.Count > 0)
                        {
                            if (insertData.num_of_student != Convert.ToUInt32(allData5[0]["NUM_OF_STUDENT"].ToString()))
                            {
                                response = "จำนวนนักศึกษาของสาขาวิชานี้ ถูกกำหนดไว้แล้ว คือ " + allData5[0]["NUM_OF_STUDENT"].ToString() + " คน";
                            }
                            else
                            {
                                oracleObj.SelectCommand = "SELECT CONFIG_STD_ID_SEQ.NEXTVAL FROM DUAL";
                                DataView seq     = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
                                int      nextval = Convert.ToInt32(seq[0]["NEXTVAL"]);

                                oracleObj.InsertCommand = "Insert Into STUDENT_ID_CONFIG(ID,FACULTY_CODE, DEPARTMENT_CODE, MAJOR_CODE, DEGREE_ADMISSION, ADMISSION_TYPE, GEN_TYPE, SEC_NO, PROJECT_CODE,PROJECT_SELECTED,MAJOR_STUDENT_ID,NUM_OF_STUDENT) Values(" + seq[0]["NEXTVAL"].ToString() + ",'" + insertData.Faculty_Code + "','" + insertData.Department_Code + "','" + insertData.Major_Code + "','" + insertData.Degree_Admission + "','" + insertData.Admission_Type + "','" + insertData.Gen_Type + "','" + insertData.Sec_No + "','" + insertData.Project_Code + "','" + insertData.Project_Selected + "','" + insertData.Major_Student_ID + "'," + insertData.num_of_student + ")";

                                if (oracleObj.Insert() == 1)
                                {
                                    response = "OK";
                                }
                            }
                        }
                        else
                        {
                            oracleObj.SelectCommand = "SELECT CONFIG_STD_ID_SEQ.NEXTVAL FROM DUAL";
                            DataView seq     = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
                            int      nextval = Convert.ToInt32(seq[0]["NEXTVAL"]);

                            oracleObj.InsertCommand = "Insert Into STUDENT_ID_CONFIG(ID,FACULTY_CODE, DEPARTMENT_CODE, MAJOR_CODE, DEGREE_ADMISSION, ADMISSION_TYPE, GEN_TYPE, SEC_NO, PROJECT_CODE,PROJECT_SELECTED,MAJOR_STUDENT_ID,NUM_OF_STUDENT) Values(" + seq[0]["NEXTVAL"].ToString() + ",'" + insertData.Faculty_Code + "','" + insertData.Department_Code + "','" + insertData.Major_Code + "','" + insertData.Degree_Admission + "','" + insertData.Admission_Type + "','" + insertData.Gen_Type + "','" + insertData.Sec_No + "','" + insertData.Project_Code + "','" + insertData.Project_Selected + "','" + insertData.Major_Student_ID + "'," + insertData.num_of_student + ")";

                            if (oracleObj.Insert() == 1)
                            {
                                response = "OK";
                            }
                        }
                    }
                }
                else
                {
                    oracleObj.SelectCommand = "SELECT CONFIG_STD_ID_SEQ.NEXTVAL FROM DUAL";
                    DataView seq     = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
                    int      nextval = Convert.ToInt32(seq[0]["NEXTVAL"]);

                    oracleObj.InsertCommand = "Insert Into STUDENT_ID_CONFIG(ID,FACULTY_CODE, DEPARTMENT_CODE, MAJOR_CODE, DEGREE_ADMISSION, ADMISSION_TYPE, GEN_TYPE, SEC_NO, PROJECT_CODE,PROJECT_SELECTED,MAJOR_STUDENT_ID,NUM_OF_STUDENT) Values(" + seq[0]["NEXTVAL"].ToString() + ",'" + insertData.Faculty_Code + "','" + insertData.Department_Code + "','" + insertData.Major_Code + "','" + insertData.Degree_Admission + "','" + insertData.Admission_Type + "','" + insertData.Gen_Type + "','" + insertData.Sec_No + "','" + insertData.Project_Code + "','" + insertData.Project_Selected + "','" + insertData.Major_Student_ID + "'," + insertData.num_of_student + ")";

                    if (oracleObj.Insert() == 1)
                    {
                        response = "OK";
                    }
                }
            }
        }
        catch (Exception err)
        {
            HttpContext.Current.Session["response"] = "Unit Test:StudentIDConfig:insertConfig" + " ไม่สามารถดำเนินการได้ ";
            HttpContext.Current.Response.Redirect("err_response.aspx");
        }

        return(response);
    }
Ejemplo n.º 8
0
        public static void DatabaseGeneralUpdate()
        {
            int numSplit = 2;
            ConcurrentDictionary <string, Dictionary <DateTime, Dictionary <string, HashSet <double> > > > Deal_Date_Tranche_Price = new ConcurrentDictionary <string, Dictionary <DateTime, Dictionary <string, HashSet <double> > > >();
            string Query = string.Format("SELECT `TRANCHEID`,DATE(`RECEIVEDTIME`),`SUGGESTEDPRICE` FROM CONSOLIDATEDPRICE " +
                                         "WHERE  `YIELD(T2R)` IS NULL AND `SUGGESTEDPRICE` IS NOT NULL AND `REGION` = 'US' " +
                                         "AND `RECEIVEDTIME` > '{0}' AND `TRANCHEID` IS NOT NULL AND `TRANCHEID` <> '' " +
                                         "AND `MODIFIEDRATING` <> '' AND `MODIFIEDRATING` <> 'EQ' AND `MODIFIEDRATING` IS NOT NULL " +
                                         "AND `SUGGESTEDPRICE` > 10 ORDER BY RECEIVEDTIME DESC", DateTime.Today.AddDays(-100));

            List <List <string> > QueryResult = ConnectDB.ReadDB(2, Query);

            List <string>[] DealLists = new List <string> [numSplit];

            // Read list of Deals
            foreach (List <string> iRow in QueryResult)
            {
                string   DealID   = iRow[0].Split('.')[0];
                string   Tranche  = iRow[0].Split('.')[1];
                DateTime AsOfDate = DateTime.ParseExact(iRow[1], "dd/MM/yyyy HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture);
                double   Price    = Convert.ToDouble(iRow[2]);


                if (!Deal_Date_Tranche_Price.ContainsKey(DealID))
                {
                    Deal_Date_Tranche_Price.TryAdd(DealID, new Dictionary <DateTime, Dictionary <string, HashSet <double> > >());
                }
                if (!Deal_Date_Tranche_Price[DealID].ContainsKey(AsOfDate))
                {
                    Deal_Date_Tranche_Price[DealID].Add(AsOfDate, new Dictionary <string, HashSet <double> >());
                }
                if (!Deal_Date_Tranche_Price[DealID][AsOfDate].ContainsKey(Tranche))
                {
                    Deal_Date_Tranche_Price[DealID][AsOfDate][Tranche] = new HashSet <double>();
                }
                Deal_Date_Tranche_Price[DealID][AsOfDate][Tranche].Add(Price);
            }

            // Split Deals
            string[] AllDealList = Deal_Date_Tranche_Price.Keys.ToArray();
            for (int i = 0; i < numSplit; i++)
            {
                DealLists[i] = new List <string>();
            }
            for (int i = 0; i < AllDealList.Length; i++)
            {
                DealLists[i % numSplit].Add(AllDealList[i]);
            }

            List <Task> Tasks = new List <Task>();

            for (int i = 0; i < numSplit; i++)
            {
                int ii = i;
                Tasks.Add(Task.Factory.StartNew(() => {
                    CashflowManager cm = new CashflowManager {
                        DealList = DealLists[ii], My_Deal_Date_Tranche_Price = Deal_Date_Tranche_Price
                    };
                    cm.DoWork();
                }));
            }
            Task.WaitAll(Tasks.ToArray());
        }
 public IntroductionController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
Ejemplo n.º 10
0
 public View()
 {
     con = new ConnectDB();
 }
Ejemplo n.º 11
0
 static GlobalInit()
 {
     conn = new ConnectDB();
 }
Ejemplo n.º 12
0
    // V 1.0.0
    public List <HisRegistrationData> get_HisRegistration(string academic_year, string semester, string student_id, string degree_char)
    {
        string tableName = getHisRegistrationTable(degree_char);

        List <HisRegistrationData> HisData = new List <HisRegistrationData>();

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

        oracleObj.SelectCommand = "Select DATE_TIME,REG_TYPE From " + tableName + " Where ACADEMIC_YEAR='" + academic_year + "' And SEMESTER='" + semester + "' And  STUDENT_ID='" + student_id + "' Group By DATE_TIME, REG_TYPE Order By to_date(DATE_TIME,'DD-MM-YYYY HH:MI:SS AM') ASC";

        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            HisRegistrationData his_data = new HisRegistrationData();

            string datetime = rowData["DATE_TIME"].ToString();
            string regtype  = rowData["REG_TYPE"].ToString();

            his_data.date_time = datetime;
            his_data.reg_type  = regtype;

            oracleObj.SelectCommand = "Select * From " + tableName + " Where ACADEMIC_YEAR='" + academic_year + "' And SEMESTER='" + semester + "' And  STUDENT_ID='" + student_id + "' And DATE_TIME='" + datetime + "' And REG_TYPE='" + regtype + "' Order By COURSE_CODE,SEC,SUBSEC";


            DataView allData2 = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
            foreach (DataRowView rowData2 in allData2)
            {
                his_data.academic_year = rowData2["ACADEMIC_YEAR"].ToString();
                his_data.semester      = rowData2["SEMESTER"].ToString();
                his_data.student_id    = rowData2["STUDENT_ID"].ToString();
                his_data.nation_id     = rowData2["NATION_ID"].ToString();
                his_data.passport_id   = rowData2["PASSPORT_ID"].ToString();
                his_data.course_type   = rowData2["COURSE_TYPE"].ToString();
                his_data.sec           = Convert.ToInt16(rowData2["SEC"].ToString());
                his_data.subsec        = Convert.ToInt16(rowData2["SUBSEC"].ToString());
                his_data.old_sec       = Convert.ToInt16(rowData2["OLD_SEC"].ToString());
                his_data.old_subsec    = Convert.ToInt16(rowData2["OLD_SUBSEC"].ToString());
                his_data.credit        = Convert.ToInt16(rowData2["CREDIT"].ToString());
                his_data.fee           = Convert.ToInt16(rowData2["FEE"].ToString());

                string course_type = "";

                if (his_data.course_type == "1")
                {
                    course_type = "S.";
                }
                else if (his_data.course_type == "2")
                {
                    course_type = "L.";
                }
                else if (his_data.course_type == "4")
                {
                    course_type = "T.";
                }
                else if (his_data.course_type == "5")
                {
                    course_type = "M.";
                }
                else if (his_data.course_type == "6")
                {
                    course_type = "SP.";
                }
                else if (his_data.course_type == "7")
                {
                    course_type = "D.";
                }

                if (his_data.subsec != 0)
                {
                    course_type = course_type + his_data.subsec;
                }
                else
                {
                    course_type = course_type + his_data.sec;
                }

                his_data.course_code += ", " + rowData2["COURSE_CODE"].ToString() + "(" + course_type + ")";
                his_data.payment_id   = rowData2["PAYMENT_ID"].ToString();
            }

            his_data.course_code = his_data.course_code.Substring(2);
            HisData.Add(his_data);
        }

        return(HisData);
    }
Ejemplo n.º 13
0
 public OrderDetailController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
Ejemplo n.º 14
0
 public QueueDB(ConnectDB c)
 {
     this.conn = c;
     initConfig();
 }
Ejemplo n.º 15
0
        //刷新注册连接树
        public void refreshTreeViewReg()
        {
            this.treeList1.ClearNodes();
            //加载注册数据连接
            DataTable dtable = new DataTable();

            dtable.Columns.Add("ParentID", typeof(string));
            dtable.Columns.Add("ID", typeof(string));
            dtable.Columns.Add("NAME", typeof(string));
            dtable.Columns.Add("PATH", typeof(string));
            dtable.Columns.Add("TYPE", typeof(string));
            ConnectDB      cd  = new ConnectDB();
            GetAllFeatures gaf = new GetAllFeatures();
            DataTable      dt  = cd.GetDataBySql("select * from GISDATA_REGCONNECT");

            DataRow[] dr = dt.Select("1=1");
            for (int i = 0; i < dr.Length; i++)
            {
                DataRow row     = dtable.NewRow();;
                string  regPath = dr[i]["REG_PATH"].ToString();
                string  regType = dr[i]["REG_TYPE"].ToString();
                string  name    = dr[i]["REG_NAME"].ToString();
                string  id      = dr[i]["ID"].ToString();
                row["ParentID"] = "";
                row["ID"]       = id;
                row["NAME"]     = name;
                row["PATH"]     = regPath;
                row["TYPE"]     = regType;
                dtable.Rows.Add(row);
                IFeatureWorkspace space;
                if (regType == "Access数据库")
                {
                    AccessWorkspaceFactory fac = new AccessWorkspaceFactoryClass();
                    try
                    {
                        space = (IFeatureWorkspace)fac.OpenFromFile(regPath, 0);
                    }
                    catch
                    {
                        continue;
                    }
                }
                else
                {
                    FileGDBWorkspaceFactoryClass fac = new FileGDBWorkspaceFactoryClass();
                    try
                    {
                        space = (IFeatureWorkspace)fac.OpenFromFile(regPath, 0);
                    }
                    catch
                    {
                        continue;
                    }
                }
                IWorkspace      iwk     = (IWorkspace)space;
                List <IDataset> ifcList = gaf.GetAllFeatureClass(iwk);
                for (int j = 0; j < ifcList.Count; j++)
                {
                    DataRow rowKid = dtable.NewRow();
                    rowKid["ParentID"] = id;
                    rowKid["ID"]       = int.Parse(id) * 100 + j;
                    rowKid["NAME"]     = ifcList[j].Name;
                    rowKid["PATH"]     = regPath;
                    rowKid["TYPE"]     = regType;
                    dtable.Rows.Add(rowKid);
                }
            }
            this.treeList1.DataSource = dtable;
            this.treeList1.OptionsView.ShowCheckBoxes = true;
        }
Ejemplo n.º 16
0
        public override QueryChangesResult Handle(SaveChangesAppOperationOptions options, IAppOperationContext operationContext)
        {
            QueryChangesResult result = new QueryChangesResult();

            try {
                Class_ManageSettingInstance       v_s     = new Class_ManageSettingInstance();
                List <QueryChangesetActionResult> L_chRes = new List <QueryChangesetActionResult>();
                QueryChangesetActionResult        chRes   = new QueryChangesetActionResult();
                result.QueryRef         = new QueryReference();
                result.QueryRef.Id      = options.Changeset.QueryRef.Id;
                result.QueryRef.Version = options.Changeset.QueryRef.Version;
                int user_id = options.OtherArgs.UserId;
                Dictionary <string, object> Params = options.OtherArgs.Values;
                int max_Val = ConnectDB.NullI;  int ID_Record = ConnectDB.NullI;
                foreach (KeyValuePair <string, object> p in Params)
                {
                    if (p.Key == "ID")
                    {
                        ID_Record = Convert.ToInt32(p.Value); break;
                    }
                }
                List <SettingIRPClass> Las_NameCat = Class_ManageSettingInstance.GetSettingWebQuery("XWEB_QUERY");
                QueryMetaD             MD          = v_s.GetQueryMetaData(Las_NameCat, options.Changeset.QueryRef.Id, options.OtherArgs.UserId);
                SettingIRPClass        settIRP     = Las_NameCat.Find(z => z.ID == options.Changeset.QueryRef.Id);
                if (settIRP.IS_SQL_REQUEST == false)
                {
                    List <BlockDataFind> obj_base = new List <BlockDataFind>();
                    foreach (QueryChangesetAction act in options.Changeset.Actions)
                    {
                        int D_I = ConnectDB.NullI;
                        if ((act.Type == ChangesetActionType.Update) && (ID_Record != ConnectDB.NullI))
                        {
                            obj_base = v_s.GetFieldFromFormFinder(MD, settIRP, true, Params);
                            D_I      = v_s.SaveToOrmDataEdit(MD, settIRP, obj_base, null, (int)ID_Record, user_id, out max_Val);
                            if (D_I != ConnectDB.NullI)
                            {
                                chRes.Success = true; chRes.Message = "Succesfully updated record";
                            }
                            else
                            {
                                chRes.Success = false; chRes.Message = "Error updated record";
                            }
                            chRes.Type         = ChangesetActionType.Update;
                            chRes.RecordRef    = new RecordReference();
                            chRes.RecordRef.Id = D_I;
                            L_chRes.Add(chRes);
                        }
                        else if (act.Type == ChangesetActionType.Create)
                        {
                            obj_base = v_s.GetFieldFromFormFinderCreate(MD, settIRP, true, Params);
                            D_I      = v_s.SaveToOrmDataEdit(MD, settIRP, obj_base, null, ConnectDB.NullI, user_id, out max_Val);
                            if (D_I != ConnectDB.NullI)
                            {
                                chRes.Success = true; chRes.Message = "Succesfully created new record";
                            }
                            else
                            {
                                chRes.Success = false; chRes.Message = "Error created new record";
                            }
                            chRes.Type         = ChangesetActionType.Create;
                            chRes.RecordRef    = new RecordReference();
                            chRes.RecordRef.Id = D_I;
                            L_chRes.Add(chRes);
                        }
                        else if ((act.Type == ChangesetActionType.Delete) && (ID_Record != ConnectDB.NullI))
                        {
                            if (ConnectDB.SetStatusArchive(ID_Record, MD.TableName))
                            {
                                chRes.Success      = true; chRes.Message = string.Format("Succesfully update status = 'Z' for ID = {0}, table_name={1}", ID_Record, MD.TableName);
                                chRes.Type         = ChangesetActionType.Create;
                                chRes.RecordRef    = new RecordReference();
                                chRes.RecordRef.Id = ID_Record;
                                L_chRes.Add(chRes);
                            }
                            else
                            {
                                chRes.Success      = false; chRes.Message = string.Format("Error updated status = 'Z' for ID = {0}, table_name={1}", ID_Record, MD.TableName);
                                chRes.Type         = ChangesetActionType.Delete;
                                chRes.RecordRef    = new RecordReference();
                                chRes.RecordRef.Id = ID_Record;
                                L_chRes.Add(chRes);
                            }
                        }
                    }
                }
                else
                {
                    chRes.Success = false;
                    chRes.Message = "For mode SQL-only this function not supported!";
                    L_chRes.Add(chRes);
                }
                result.Actions = L_chRes.ToArray();
                Logger.Trace(this, options, operationContext);
            }
            catch (Exception ex) { Logger.Error(ex); }
            return(result);
        }
Ejemplo n.º 17
0
 public ToppingsLogic()
 {
     _connectDB = new ConnectDB();
 }
Ejemplo n.º 18
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        try
        {
            string ID = Request.QueryString["ID"];
            if (!string.IsNullOrEmpty(ID))
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("UPDATE Mas_Product set ");
                // sb.Append("ProductCode=@ProductCode,");
                sb.Append("Urent=@Urent,");
                sb.Append("ProductDetailTH=@ProductDetailTH,");
                sb.Append("ProductDetailEN=@ProductDetailEN,");
                sb.Append("ProductSize=@ProductSize,");
                sb.Append("ProductColor=@ProductColor,");
                sb.Append("ProductTypeCode=@ProductTypeCode,");
                sb.Append("ProductGroupCode=@ProductGroupCode,");
                sb.Append("ProductAmount=@ProductAmount,");
                sb.Append("CreateBy=@CreateBy,");
                sb.Append("UpdateBy=@UpdateBy,");
                sb.Append("CreateDate=@CreateDate,");
                sb.Append("UpdateDate=@UpdateDate,");
                sb.Append("IsActive=@IsActive ");
                sb.Append("Where ProductCode = @ProductCode");


                SqlParameterCollection param = new SqlCommand().Parameters;
                // param.AddWithValue("@ProductCode", pd_code.Value);
                param.AddWithValue("@Urent", pd_urent.Value);
                param.AddWithValue("@ProductDetailTH", pd_thainame.Value);
                param.AddWithValue("@ProductDetailEN", pd_engname.Value);
                param.AddWithValue("@ProductSize", pd_size.Value);
                param.AddWithValue("@ProductColor", pd_color.Value);
                param.AddWithValue("@ProductTypeCode", pd_type.Value);
                param.AddWithValue("@ProductGroupCode", pd_group.Value);
                param.AddWithValue("@ProductAmount", pd_amount.Value);
                param.AddWithValue("@CreateBy", createby.Value);
                param.AddWithValue("@UpdateBy", updateby.Value);

                if (status.Checked)
                {
                    param.AddWithValue("@IsActive", 1);
                }
                else
                {
                    param.AddWithValue("@IsActive", 0);
                }

                //param.AddWithValue("@UpdatePersonID", ucUserAuthen.UserAuthen.Current.UserID);

                param.AddWithValue("@UpdateDate", DateTime.Now);
                param.AddWithValue("@CreateDate", DateTime.Now);
                param.AddWithValue("@ProductCode", ID);

                //ConnectDB db = new ConnectDB();
                ConnectDB.ExecuteData(sb.ToString(), param);
            }
            else
            {
                Product_form.Visible = false;
            }
        }
        catch (Exception ex)
        {
            //registrationForm.Visible = false;
            Response.Write(ex.Message.ToString());
        }
        Response.Redirect("ProductMain.aspx");
    }
 public RepositoryBase()
 {
     // Recuperation de la valeur de la ConnectionString depuis les fichiers de config de l'app !
     _ConnectionString = ConfigurationManager.ConnectionStrings["db-source"].ConnectionString;
     _Connector        = new ConnectDB(_ConnectionString);
 }
Ejemplo n.º 20
0
        // Método para rellenar tabla con una consulta
        // El primer elemento de la consulta se mantendrá oculto(ID)
        //
        // tabla -> DataGridView a rellenar
        // consulta -> Consulta SQL para obtener los valores
        //
        // Métodos para extraer datos
        //
        // Celda seleccionada = dgv.currentCell
        // Fila Seleccionadda = dgv.CurrentRow
        // Seleccionar Celda index (0-n) dentro de la fila seleccionada = dgv..CurrentRow.Cells.IndexOf(posicion)
        //
        public void rellenaDGV(DataGridView tabla, String consulta)
        {
            DataSet Data = new DataSet();
            ConnectDB Search = new ConnectDB();

            Data = Search.getData(consulta, "tabla");
            DataTable ttablas = Data.Tables["tabla"];

            tabla.DataSource = ttablas;
            tabla.Columns[0].Visible = false; // Se oculta la primera columna
        }
Ejemplo n.º 21
0
    public string[] insertWaveSchlor(List <PayScholarData> InsertData, string payment_id, string payment_date, string payment_time)
    {
        string sql = "";

        string[] response = new string[InsertData.Count];;

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


        int i = 0;

        foreach (PayScholarData insertData in InsertData)
        {
            sql = "Insert Into SCHOLAR_WAVE_DATA(PAYMENT_ID,STUDENT_ID,NATION_ID,PASSPORT_ID,STUDENT_NAME,ACADEMIC_YEAR,SEMESTER,SCHOLAR_CODE,PAYMENT_DATE,PAYMENT_TIME,THEORY_PRACTICE_FEE,THESIS_PROJECT_FEE,PACKET_FEE,NEW_REGIS_FEE,CARD_FEE,STUDY_FACILITY_FEE,IT_FEE,HEALTH_FEE,LIBRARY_FEE,PROPERTIES_FEE,ACCIDENT_FEE,ACADEMIC_FEE,MORAL_FEE,ACTIVITY_FEE,AMOUNT,STATUS,STUDENT_STATUS_FEE,STUDENT_RETURN_FEE,CHARGE,QE_FEE,TRAINEE_FEE) Values('" + payment_id + "','" + insertData.Student_ID + "','" + insertData.Nation_ID + "','" + insertData.Passport_ID + "','" + insertData.Student_Name + "','" + insertData.Academic_Year + "','" + insertData.Semester + "','" + insertData.Scholar_Code + "','" + payment_date + "','" + payment_time + "'," + insertData.Theory_Practice_Fee + "," + insertData.Thesis_Project_Fee + "," + insertData.Packet_Fee + "," + insertData.NewRegis_Fee + "," + insertData.Card_Fee + "," + insertData.Student_Facility_Fee + "," + insertData.IT_Fee + "," + insertData.Health_Fee + "," + insertData.Library_Fee + "," + insertData.Properties_Fee + "," + insertData.Accident_Fee + "," + insertData.Academic_Fee + "," + insertData.Moral_Fee + "," + insertData.Activity_Fee + "," + insertData.Amount + ",'" + insertData.Status + "'," + insertData.StudentStatus_Fee + "," + insertData.StudentReturn_Fee + "," + insertData.Charge + "," + insertData.QE_Fee + "," + insertData.Trainee_Fee + ")";

            oracleObj.InsertCommand = sql;

            // ======= Log ======
            LogData log_data = new LogData();
            log_data.ModuleCode = new LogData().Module_Registration;

            if (HttpContext.Current.Session["login_data"] != null)
            {
                UserLoginData login_data = (UserLoginData)HttpContext.Current.Session["login_data"];
                log_data.Username = login_data.User_ID;
            }
            else
            {
                log_data.Username = insertData.Student_ID;
            }

            log_data.Message = "Create WaveScholar Data With:" + payment_id + "','" + insertData.Student_ID + "','" + insertData.Nation_ID + "','" + insertData.Passport_ID + "','" + insertData.Student_Name + "','" + insertData.Academic_Year + "','" + insertData.Semester + "','" + insertData.Scholar_Code + "','" + payment_date + "','" + payment_time + "'," + insertData.Theory_Practice_Fee + "," + insertData.Thesis_Project_Fee + "," + insertData.Packet_Fee + "," + insertData.NewRegis_Fee + "," + insertData.Card_Fee + "," + insertData.Student_Facility_Fee + "," + insertData.IT_Fee + "," + insertData.Health_Fee + "," + insertData.Library_Fee + "," + insertData.Properties_Fee + "," + insertData.Accident_Fee + "," + insertData.Academic_Fee + "," + insertData.Moral_Fee + "," + insertData.Activity_Fee + "," + insertData.Amount + ",'" + insertData.Status + "'," + insertData.StudentStatus_Fee + "," + insertData.StudentReturn_Fee + "," + insertData.Charge + "," + insertData.QE_Fee + "," + insertData.Trainee_Fee;
            // ==================

            try
            {
                if (oracleObj.Insert() == 1)
                {
                    response[i] = "OK";

                    log_data.StatusCode = log_data.LogStatus_SUCCESS;
                }
                else
                {
                    log_data.StatusCode = log_data.LogStatus_FAILED;
                }

                new Log().WriteLog(log_data);
            }
            catch (Exception e)
            {
                log_data.StatusCode = log_data.LogStatus_ERROR;
                log_data.Message   += " [" + e.ToString() + "]";
                new Log().WriteLog(log_data);

                HttpContext.Current.Session["response"] = "Unit Test:PaySchlar:insertWaveSchlor" + " ไม่สามารถดำเนินการได้";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }


            i++;
        }



        return(response);
    }
Ejemplo n.º 22
0
 public QuangcaoController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
 public PermissionController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
Ejemplo n.º 24
0
 private void Login_Load(object sender, EventArgs e)
 {
     ConnectDB.getData();
 }
        public void SearchIdMember(string nomorKtp, IOnLoginPengunjungFinishedListener listener)
        {
            connection = ConnectDB.ConnectingDB();

            try
            {
                connection.Open();
                string query = "SELECT * FROM `member` WHERE `noKTP`= '" + nomorKtp + "'";

                Boolean error = true;

                MySqlCommand command = connection.CreateCommand();
                command.CommandText = query;

                MySqlDataReader reader = command.ExecuteReader();


                while (reader.Read())
                {
                    if (reader.GetString(0).ToString() == nomorKtp)
                    {
                        memberModel.setNomorKtp(reader.GetString(0).ToString());


                        memberModel.setNama(reader.GetString(1).ToString());


                        memberModel.setJenisKelamin(reader.GetString(2).ToString());

                        memberModel.setKewarganegaraan(reader.GetString(3).ToString());

                        memberModel.setTanggalLahir(reader.GetString(4).ToString());


                        memberModel.setAgama(reader.GetString(5).ToString());


                        memberModel.setNomorTlp(reader.GetString(6).ToString());

                        memberModel.setEmail(reader.GetString(7).ToString());



                        memberModel.setAlamat(reader.GetString(8).ToString());



                        memberModel.setKecamatan(reader.GetString(9).ToString());


                        memberModel.setRtRw(reader.GetString(10).ToString());

                        listener.onSuccessCariIdMember(memberModel);

                        error = false;
                    }
                }

                if (error == true)
                {
                    listener.onErrorCariIdMember();
                }
                connection.Close();
            }

            catch (Exception e)
            {
                Console.WriteLine("Error:" + e);
            }
        }
Ejemplo n.º 26
0
 public AddressBaohanhController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
Ejemplo n.º 27
0
    // V1.0.0
    public List <StudentIDConfigData> getConfigs(String faculty_code, string department_code, string major_code, string degree_admission, string admission_type)
    {
        List <StudentIDConfigData> config_data = new List <StudentIDConfigData>();

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

        string sql = "Select * From STUDENT_ID_CONFIG Where 1 = 1";

        if (faculty_code != "0")
        {
            sql += " And FACULTY_CODE='" + faculty_code + "'";
        }

        if (department_code != "0")
        {
            sql += " And DEPARTMENT_CODE='" + department_code + "'";
        }

        if (major_code != "0")
        {
            sql += " And MAJOR_CODE='" + major_code + "'";
        }

        if (degree_admission != "0")
        {
            sql += " And DEGREE_ADMISSION='" + degree_admission + "'";
        }

        if (admission_type != "0")
        {
            sql += " And ADMISSION_TYPE='" + admission_type + "'";
        }

        try
        {
            oracleObj.SelectCommand = sql;

            DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);


            foreach (DataRowView rowData in allData)
            {
                StudentIDConfigData config = new StudentIDConfigData();
                config.ID               = Convert.ToInt32(rowData["ID"].ToString());
                config.Faculty_Code     = rowData["FACULTY_CODE"].ToString();
                config.Department_Code  = rowData["DEPARTMENT_CODE"].ToString();
                config.Major_Code       = rowData["MAJOR_CODE"].ToString();
                config.Degree_Admission = rowData["DEGREE_ADMISSION"].ToString();
                config.Admission_Type   = rowData["ADMISSION_TYPE"].ToString();
                config.Gen_Type         = rowData["GEN_TYPE"].ToString();
                config.Sec_No           = rowData["SEC_NO"].ToString();
                config.Project_Selected = rowData["PROJECT_SELECTED"].ToString();
                config.Project_Code     = rowData["PROJECT_CODE"].ToString();
                config.Major_Student_ID = rowData["MAJOR_STUDENT_ID"].ToString();
                config.num_of_student   = Convert.ToUInt32(rowData["NUM_OF_STUDENT"].ToString());
                config_data.Add(config);
            }
        }
        catch
        {
            HttpContext.Current.Session["response"] = "Unit Test:StudentIDConfig:getConfigs" + " ไม่สามารถดำเนินการได้ ";
            HttpContext.Current.Response.Redirect("err_response.aspx");
        }



        return(config_data);
    }
        protected void Button2_Click(object sender, EventArgs e)
        {
            string message = "";
            string subject = "SHOWTIME : TICKET BOOKED";

            String    movie_id = Request.QueryString["id"];
            ConnectDB cdb      = new ConnectDB();

            cdb.connectDataBase();
            SqlConnection con = cdb.connect;

            con.Open();
            SqlCommand com = cdb.command;

            int    selected   = 0;
            int    items      = 0;
            string theater_id = "";

            com.CommandText = "SELECT theater_user.address,theater_user.city,theater_user.state,[user].name,movie.name,screen.screen_no,show.show_date,show.show_time FROM class INNER JOIN screen ON class.screen_id = screen.screen_id INNER JOIN seat ON class.class_id = seat.class_id INNER JOIN show ON screen.screen_id = show.screen_id INNER JOIN movie ON show.movie_id = movie.movie_id INNER JOIN theater_user ON screen.user_id = theater_user.user_id INNER JOIN [user] ON theater_user.user_id = [user].user_id WHERE [show].show_date='" + TextBox1.Text + "' AND [show].movie_id='" + Session["movie_id"] + "' AND [theater_user].city='" + DropDownList1.SelectedValue + "' AND [user].name = '" + DropDownList2.SelectedValue + "' AND [show].show_time='" + DropDownList3.SelectedValue + "'";
            SqlDataReader rdr0 = com.ExecuteReader();

            rdr0.Read();
            message = "Movie : " + rdr0[4].ToString() + "<br>Theater : " + rdr0[3] + "<br>Address : " + rdr0[0] + ", " + rdr0[1] + ", " + rdr0[2] + "<br>Date : " + rdr0[6].ToString().Substring(0, 10) + "<br>Time : " + rdr0[7] + "<br>Screen Number : " + rdr0[5] + "<br>Seats : ";
            rdr0.Close();
            foreach (ListItem li in CheckBoxList1.Items)
            {
                items++;
                if (li.Selected)
                {
                    message += li.Text + "  ";
                    selected++;

                    int temp_item = items;
                    com.CommandText = "SELECT theater_user.user_id,seat.seat_id,show.show_id FROM class INNER JOIN screen ON class.screen_id = screen.screen_id INNER JOIN seat ON class.class_id = seat.class_id INNER JOIN show ON screen.screen_id = show.screen_id INNER JOIN show_price ON class.class_id = show_price.class_id AND show.show_id = show_price.show_id INNER JOIN theater_user ON screen.user_id = theater_user.user_id INNER JOIN [user] ON theater_user.user_id = [user].user_id WHERE [show].show_date='" + TextBox1.Text + "' AND [show].movie_id='" + Session["movie_id"] + "' AND [theater_user].city='" + DropDownList1.SelectedValue + "' AND [user].name = '" + DropDownList2.SelectedValue + "' AND [show].show_time='" + DropDownList3.SelectedValue + "'";
                    SqlDataReader rdr = com.ExecuteReader();



                    while (temp_item > 0)
                    {
                        rdr.Read();
                        temp_item--;
                    }
                    theater_id = rdr["user_id"].ToString();
                    string seat_id = rdr["seat_id"].ToString();
                    string show_id = rdr["show_id"].ToString();
                    string user_id = Session["user_id"].ToString();

                    rdr.Close();

                    com.CommandText = "INSERT INTO [dbo].[ticket](seat_id, show_id, user_id) VALUES ('" + seat_id + "','" + show_id + "','" + user_id + "')";
                    com.ExecuteNonQuery();
                }
            }

            com.CommandText = "SELECT payment FROM [dbo].[theater_user] WHERE user_id=@user_id";
            com.Parameters.AddWithValue("@user_id", theater_id);
            SqlDataReader rdr1 = com.ExecuteReader();

            rdr1.Read();
            int payment = Int32.Parse(rdr1["payment"].ToString());

            payment += Int32.Parse(Label20.Text);
            rdr1.Close();

            com.CommandText = "UPDATE theater_user SET payment=@payment WHERE user_id=@user_id1";
            com.Parameters.AddWithValue("@payment", payment);
            com.Parameters.AddWithValue("@user_id1", theater_id);
            com.ExecuteNonQuery();

            com.CommandText = "SELECT email FROM [user] WHERE user_id=@user_id3";
            com.Parameters.AddWithValue("@user_id3", Session["user_id"]);
            SqlDataReader rdr2 = com.ExecuteReader();

            rdr2.Read();
            string to = rdr2[0].ToString();

            rdr2.Close();
            con.Close();

            SendEmail se = new SendEmail();

            se.sendEmail(to, subject, message, "");

            Response.Redirect("AfterBooking.aspx");
        }
        protected void View3_Activate(object sender, EventArgs e)
        {
            int r = (int)(TextBox4.Text.ToUpper()[0]) - 64;
            int c = Int32.Parse(TextBox3.Text);

            TableRow hrow = new TableRow();

            for (int j = 0; j <= c; j++)
            {
                TableCell cell = new TableCell();
                cell.Width = 20;
                Label l = new Label();
                if (j == 0)
                {
                    l.Text = " ";
                }
                else
                {
                    l.Text = j.ToString();
                }
                cell.Controls.Add(l);
                hrow.Cells.Add(cell);
            }
            Table5.Rows.Add(hrow);

            for (int i = 1; i <= r; i++)
            {
                TableRow row = new TableRow();
                for (int j = 0; j <= c; j++)
                {
                    TableCell cell = new TableCell();
                    cell.Width = 20;
                    if (j == 0)
                    {
                        Label l = new Label();
                        l.Text = Convert.ToChar(i + 64).ToString();
                        cell.Controls.Add(l);
                    }
                    else
                    {
                        Image img = new Image();
                        img.ImageUrl = "gchair.png";
                        cell.Controls.Add(img);
                    }
                    row.Cells.Add(cell);
                }
                Table5.Rows.Add(row);
            }

            String[] selected = new String[4];
            int[]    val      = new int[4] {
                0, 0, 0, 0
            };


            int h = 0;

            foreach (int i in ListBox1.GetSelectedIndices())
            {
                selected[h++] = ListBox1.Items[i].ToString();
            }

            if (h >= 4)
            {
                val[3] = (int)(TextBox8.Text.ToUpper()[0]) - 64;
            }
            if (h >= 3)
            {
                val[2] = (int)(TextBox7.Text.ToUpper()[0]) - 64;
            }
            if (h >= 2)
            {
                val[1] = (int)(TextBox6.Text.ToUpper()[0]) - 64;
            }
            if (h >= 1)
            {
                val[0] = (int)(TextBox5.Text.ToUpper()[0]) - 64;
            }

            int    itemp;
            string stemp;

            for (int u = 0; u < h - 1; u++)
            {
                for (int v = 0; v < h - u - 1; v++)
                {
                    if (val[v] > val[v + 1])
                    {
                        itemp           = val[v];
                        val[v]          = val[v + 1];
                        val[v + 1]      = itemp;
                        stemp           = selected[v];
                        selected[v]     = selected[v + 1];
                        selected[v + 1] = stemp;
                    }
                }
            }

            for (int g = h - 1; g >= 0; g--)
            {
                TableRow  row  = new TableRow();
                TableCell cell = new TableCell();
                cell.Text            = selected[g];
                cell.ColumnSpan      = c;
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.Font.Bold       = true;
                row.Cells.Add(cell);
                Table5.Rows.AddAt(val[g], row);
            }


            ConnectDB cdb = new ConnectDB();

            cdb.connectDataBase();
            SqlConnection con = cdb.connect;

            con.Open();
            SqlCommand com = cdb.command;

            com.CommandText = "insert into [dbo].[screen] (screen_no,user_id) values (@screen_no,@user_id)";
            com.Parameters.AddWithValue("@screen_no", TextBox2.Text);
            com.Parameters.AddWithValue("@user_id", Session["user_id"]);
            com.ExecuteNonQuery();

            com.CommandText = "SELECT screen_id FROM [dbo].[screen] WHERE screen_no=@screen_no1 AND user_id=@user_id1";
            com.Parameters.AddWithValue("@screen_no1", TextBox2.Text);
            com.Parameters.AddWithValue("@user_id1", Session["user_id"]);
            SqlDataReader rdr = com.ExecuteReader();

            rdr.Read();
            String screen_id = rdr["screen_id"].ToString();

            rdr.Close();

            foreach (int i in ListBox1.GetSelectedIndices())
            {
                com.CommandText = "insert into [dbo].[class] (seat_class,screen_id) values ('" + ListBox1.Items[i].ToString() + "','" + screen_id + "')";
                com.ExecuteNonQuery();
            }

            for (int z = 0; z < h; z++)
            {
                com.CommandText = "SELECT class_id FROM [dbo].[class] WHERE seat_class='" + selected[z] + "' AND screen_id='" + screen_id + "'";
                SqlDataReader rdr1 = com.ExecuteReader();
                rdr1.Read();
                String class_id = rdr1["class_id"].ToString();
                rdr1.Close();

                int start = val[z];
                int end   = 0;
                if (z == h - 1)
                {
                    end = r + 1;
                }
                else
                {
                    end = val[z + 1];
                }

                while (start != end)
                {
                    for (int d = 1; d <= c; d++)
                    {
                        com.CommandText = "INSERT INTO [dbo].[seat](seat_no,class_id) VALUES ('" + Convert.ToChar(start + 64).ToString() + d.ToString() + "','" + class_id + "')";
                        com.ExecuteNonQuery();
                    }
                    start++;
                }
            }
            con.Close();
        }
        protected void View2_Activate(object sender, EventArgs e)
        {
            String    movie_id = Request.QueryString["id"];
            ConnectDB cdb      = new ConnectDB();

            cdb.connectDataBase();
            SqlConnection con = cdb.connect;

            con.Open();
            SqlCommand com = cdb.command;

            com.CommandText = "SELECT class.seat_class,show_price.price,seat.seat_no FROM class INNER JOIN screen ON class.screen_id = screen.screen_id INNER JOIN seat ON class.class_id = seat.class_id INNER JOIN show ON screen.screen_id = show.screen_id INNER JOIN show_price ON class.class_id = show_price.class_id AND show.show_id = show_price.show_id INNER JOIN theater_user ON screen.user_id = theater_user.user_id INNER JOIN [user] ON theater_user.user_id = [user].user_id WHERE [show].show_date=@show_date AND [show].movie_id=@movie_id AND [theater_user].city=@city AND [user].name = @name AND [show].show_time=@show_time";
            com.Parameters.AddWithValue("@show_date", TextBox1.Text);
            com.Parameters.AddWithValue("@movie_id", Session["movie_id"]);
            com.Parameters.AddWithValue("@city", DropDownList1.SelectedValue);
            com.Parameters.AddWithValue("@name", DropDownList2.SelectedValue);
            com.Parameters.AddWithValue("@show_time", DropDownList3.SelectedValue);

            SqlDataReader rdr = com.ExecuteReader();

            rdr.Read();
            string cls   = rdr["seat_class"].ToString();
            char   start = rdr["seat_no"].ToString()[0];
            int    i     = 0;

            Label6.Text  = cls + " : ";
            Label7.Text  = "Starts From " + start.ToString() + " - ";
            Label8.Text  = "Rs. " + rdr["price"].ToString();
            Row1.Visible = true;

            while (rdr.Read())
            {
                if (!(cls.Equals(rdr["seat_class"].ToString())))
                {
                    if (i == 0)
                    {
                        Label9.Text  = rdr["seat_class"].ToString() + " : ";
                        Label10.Text = "Starts From " + rdr["seat_no"].ToString()[0].ToString() + " - ";
                        Label11.Text = "Rs. " + rdr["price"].ToString();
                        Row2.Visible = true;
                    }
                    if (i == 1)
                    {
                        Label12.Text = rdr["seat_class"].ToString() + " : ";
                        Label13.Text = "Starts From " + rdr["seat_no"].ToString()[0].ToString() + " - ";
                        Label14.Text = "Rs. " + rdr["price"].ToString();
                        Row3.Visible = true;
                    }
                    if (i == 2)
                    {
                        Label15.Text = rdr["seat_class"].ToString() + " : ";
                        Label16.Text = "Starts From " + rdr["seat_no"].ToString()[0].ToString() + " - ";
                        Label17.Text = "Rs. " + rdr["price"].ToString();
                        Row4.Visible = true;
                    }
                    i++;
                }
                cls = rdr["seat_class"].ToString();
            }
            con.Close();
        }
Ejemplo n.º 31
0
 public ProductImageController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
Ejemplo n.º 32
0
        public async Task QuizMessageReceivedAsync(IDialogContext context, IAwaitable <object> result)
        {
            try
            {
                var activity = await result as Activity;

                if (activity == null)
                {
                    activity = context.Activity as Activity;
                }

                ConnectDB connect = new ConnectDB();
                await connect.CreateDocumentIfNotExists("Message", activity);

                await connect.SaveMessage("Message", activity);

                if (_db.ConversationStatus == (int)QuizEnum.Init)
                {
                    await ConversationInit(activity, context);
                }
                else if (_db.ConversationStatus == (int)QuizEnum.Pergunta1)
                {
                    await ConversationPergunta1(activity, context);
                }
                else if (_db.ConversationStatus == (int)QuizEnum.Pergunta2)
                {
                    await ConversationPergunta2(activity, context);
                }
                else if (_db.ConversationStatus == (int)QuizEnum.Pergunta3)
                {
                    await ConversationPergunta3(activity, context);
                }
                else if (_db.ConversationStatus == (int)QuizEnum.Pergunta4)
                {
                    await ConversationPergunta4(activity, context);
                }
                else if (_db.ConversationStatus == (int)QuizEnum.Pergunta5)
                {
                    await ConversationPergunta5(activity, context);
                }
                else if (_db.ConversationStatus == (int)QuizEnum.Pergunta6)
                {
                    await ConversationPergunta6(activity, context);
                }
                else if (_db.ConversationStatus == (int)QuizEnum.Pergunta7)
                {
                    await ConversationPergunta7(activity, context);
                }
                else if (_db.ConversationStatus == (int)QuizEnum.Pergunta8)
                {
                    await ConversationPergunta8(activity, context);
                }
                else if (_db.ConversationStatus == (int)QuizEnum.Pergunta9)
                {
                    await ConversationPergunta9(activity, context);
                }
                else if (_db.ConversationStatus == (int)QuizEnum.Pergunta10)
                {
                    await ConversationFinal(activity, context);
                }
                else if (_db.ConversationStatus == (int)QuizEnum.Fim)
                {
                    await ConversationConclusao(activity, context);
                }
            }
            catch (Exception ex)
            {
                context.Done(new ResultDialog {
                    Activity = context.Activity as Activity
                });
            }
        }
Ejemplo n.º 33
0
 public PhukienController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
 public DanhmucsanphamController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }