Ejemplo n.º 1
0
    protected void ExportFile_ALL(object sender, EventArgs e)
    {
        GridView GridView_01 = (GridView)Panel1.FindControl("GridView_01");
        string   views       = "";

        foreach (GridViewRow row in GridView_01.Rows)
        {
            string viewname = row.Cells[11].Text;
            views += row.Cells[11].Text + " <br/>";

            try
            {
                SqlCommand sqlCmd = new System.Data.SqlClient.SqlCommand("exec spNDAR__ExportFile '" + viewname + "'", oConnData);
                sqlCmd.ExecuteNonQuery();
            }
            catch (SqlException exc)
            {
                LogToPageError(exc.Message);
            }
        }


        //refresh the page
        LoadGrids();
    }
Ejemplo n.º 2
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        int           count = Convert.ToInt32(Session["clicks"]);
        SqlConnection con   = new SqlConnection(sqlcon);

        con.Open();
        SqlCommand cmd = new SqlCommand();

        cmd.Connection = con;
        for (int i = 0; i < count; i++)
        {
            TextBox tb       = new TextBox();
            string  OptionID = "TextBoxU" + i;
            tb = (TextBox)Panel1.FindControl(OptionID);
            //TextBox tb = Panel1.FindControl("TextBoxU0") as TextBox;
            cmd.CommandText = "insert into Category(CategoryName)values('" + tb.Text + "')";
            cmd.ExecuteNonQuery();


            //TextBox txt;

            //foreach (Control c in Panel1.Controls)
            //{
            //    if (c.GetType() == typeof(TextBox))
            //    {
            //        txt = (TextBox)c;
            //        String str = txt.Text;
            //    }
            //}
        }
    }
Ejemplo n.º 3
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        int    n    = Convert.ToInt16(Session["n"]);
        string sans = "";

        for (int i = 1; i <= n; i++)
        {
            RadioButtonList list = (RadioButtonList)Panel1.FindControl("cbk" + i.ToString());
            if (list != null)
            {
                if (list.SelectedValue.ToString() != "")
                {
                    sans += list.SelectedValue.ToString();
                }
                else
                {
                    sans += "0";
                }
            }
        }
        Session["Sans"] = sans;
        //string sql = "Insert into tb_expnum set StuNo='" + Session["ID"] + "',StuName='" + Session["name"] + "',RightAns='" + Session["Sans"].ToString() + "', StudentAns='" + sans + "'";
        string sql = "update tb_expnum set StudentAns='" + sans + "' where StuNo='" + Session ["ID"].ToString() + "'";

        BaseClass.OperateData(sql);
        Response.Redirect("ExamResult.aspx?BInt=" + n.ToString());
    }
Ejemplo n.º 4
0
        private bool Check()
        {
            bool check = false;
            int  count = 0;

            for (int i = 0; i < 10; i++)
            {
                CheckBoxList ck = (CheckBoxList)Panel1.FindControl("cki" + i.ToString());
                if (ck != null)
                {
                    for (int j = 0; j < ck.Items.Count; j++)
                    {
                        if (ck.Items[j].Selected == true)
                        {
                            count++;
                        }
                    }
                }
            }
            if (count == 0)
            {
                ScriptManager.RegisterStartupScript(this.Page, GetType(), "", "alert('没有选择任何审批人!!');", true); return(check);
            }
            if (txt_zdrYJ.Text.Trim() == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, GetType(), "", "alert('没有填写制单人意见!!');", true); return(check);
            }
            return(true);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitializeSession();
                InitializeControls();
            }
            else
            {
                Page.ClientScript.GetPostBackEventReference(this, String.Empty);
                String eventTarget = Request["__EVENTTARGET"].IsNullOrEmpty() ? String.Empty : Request["__EVENTTARGET"];
                if (eventTarget.Equals("SearchEmployee"))
                {
                    String EmployeeCode = Request["__EVENTARGUMENT"].IsNullOrEmpty() ? String.Empty : Request["__EVENTARGUMENT"];
                    //if (EmployeeCode.IsNullOrEmpty())
                    EmployeeCode     = "103775";// ((TextBox)this.Header1.FindControl("txtSearch")).Text.ToString();
                    _CurrentPosition = ManagerPromotion.GetAllExistingInfoForPromotion(EmployeeCode, Convert.ToInt32(ASL.Hr.DAO.enumsHr.enumEntitySetup.PromotionCriteria));
                    if (_entityList.Count == 0 && _CurrentPosition.Count == 0)
                    {
                        return;
                    }
                    foreach (EntityList M in _entityList)
                    {
                        TransferAndPromotionHistory obj = _CurrentPosition.Find(f => f.EntityName == M.EntityName);
                        TextBox txt = (TextBox)Panel1.FindControl("txtCurrent" + M.EntityName.ToString());
                        txt.Text = obj.PreHKEntryName.ToString();

                        DropDownList ddl = (DropDownList)Panel1.FindControl("ddlPost" + M.EntityName.ToString());
                        ddl.Text = obj.PreHKEntryID.ToString();
                    }
                }
            }
        }
Ejemplo n.º 6
0
    private void dynamicbutton_Click(Object sender, System.EventArgs e)
    {
        String strSQL = "select name  from polling_in where name='" + this.CurrentUser.LogonID + "' and id_p='4' ";
        string connstr;

        //Response.Write(strSQL);
        connstr = (System.Web.Configuration.WebConfigurationManager.ConnectionStrings["EIPAConnectionString"].ConnectionString);                  //連線資料
        SqlConnection conn = new SqlConnection(connstr);

        conn.Open();
        SqlCommand cmd = new SqlCommand(strSQL, conn);
        //cmd.Connection.Open();                              //打開連線
        SqlDataReader dr = cmd.ExecuteReader();             //讀取內容

        if (dr.Read())
        {
            //Response.Write("不可投票");
            Response.Write("<script language='JavaScript'>window.alert('投票已截止囉!');</script>");
            GotoDefault();
        }
        else
        {
            RadioButtonList tb = new RadioButtonList();
            tb = (RadioButtonList)(Panel1.FindControl("dynamictextbox"));
            //Label1.Text = tb.Text;
            if (this.CurrentUser.LogonID == "")
            {
                Response.Write("<script language='JavaScript'>window.alert('請先登入!');</script>");
                GotoDefault();
            }
            else if (tb.Text == "")
            {
                Response.Write("<script language='JavaScript'>window.alert('請輸入選項!');</script>");
            }
            else
            {
                //TextBox ta = new TextBox();
                //ta = (TextBox)(Panel1.FindControl("dynamictextboxa"));
                ////string connstr;
                ////string con = "";
                ////con = RadioButtonList1.SelectedItem.Value;
                ////Response.Write(con);
                ////connstr = ("Data Source=ANNLINV\\SQLEXPRESS;Initial Catalog=TTA3;Integrated Security=True; Integrated Security=SSPI;");
                //SqlConnection connection = new SqlConnection(connstr);
                //SqlCommand DataCommand = new SqlCommand();
                //DateTime d = DateTime.Now;
                ////Response.Write("Date = " +d.Date.ToString() + "<BR>");
                //DataCommand.CommandText = "insert into polling_in(id_p,id_c,name,date,comment)values('2','" + tb.Text + "','" + this.CurrentUser.LogonID + "','" + d.ToString("yyyyMMdd") + "','" + ta.Text + "')";
                ////Response.Write(ta.Text);
                ////Response.Write(DataCommand.CommandText);
                //DataCommand.Connection = connection;
                //connection.Open();
                //DataCommand.ExecuteNonQuery();
                //connection.Close();

                Response.Write("<script language='JavaScript'>window.alert('投票已截止囉!');</script>");
                GotoDefault();
            }
        }
    }
Ejemplo n.º 7
0
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int pdfId = Convert.ToInt32(e.Keys["Id"]);

        using (MyWebSiteDatabaseEntities myEntity = new MyWebSiteDatabaseEntities())
        {
            var aramaSonucu = from pdf in myEntity.PdfFiles
                              where pdf.Id == pdfId
                              select pdf;

            if (aramaSonucu != null)
            {
                DropDownList başlıkDropDownList = (DropDownList)Panel1.FindControl("DropDownList1");
                string       başlıkİsmi         = Convert.ToString(başlıkDropDownList.SelectedItem);
                string       virtualFolder      = "~/PdfFiles/" + başlıkİsmi + "/";
                string       physicalFolder     = Server.MapPath(virtualFolder);

                PdfFile pdfFile = aramaSonucu.ToList().ElementAt(0);
                // "FileUrl"in başındaki "~/" siliniyor.
                string fileUrl = pdfFile.FileUrl.Substring(2);
                // Sitenin "root"u, "fileurl"a ekleniyor.
                // MapPath'e "~/" eklenmezse "currentServer" olarak "Management" klasörünü alıyor.
                string fullPath = Server.MapPath("~/" + fileUrl);

                // Pdf dosyası bulunursa siliniyor.
                if (File.Exists(fullPath))
                {
                    File.Delete(fullPath);
                }
            }
        }
    }
 protected void imgbtnDelete_Click(object sender, ImageClickEventArgs e)
 {
     try
     {
         ImageButton imb      = new ImageButton();
         Int32       RowIndex = -1;
         imb = (ImageButton)sender;
         if (imb != null)
         {
             hddHeaderID.Value = imb.CommandArgument;
             RowIndex          = ToInt32(imb.CommandName);
             if (RowIndex >= 0)
             {
                 ((Label)Panel1.FindControl("lbl_modal_view")).Text = "กรุณาระบุยอดเงินของรายการ [ " + gv.Rows[RowIndex].Cells[1].Text + " ]";
                 //lbl_modal_view.Text =
                 hddSellPrice.Value = gv.Rows[RowIndex].Cells[5].Text;
                 txtmSellPrice.Text = "";
             }
         }
         ModalPopupExtender1.Show();
     }
     catch (Exception ex)
     {
     }
 }
Ejemplo n.º 9
0
        protected void btnsubmit_Click(object sender, EventArgs e)
        {
            string msc = "";//建立变量msc存储考生答案

            for (int i = 1; i <= 10; i++)
            {
                RadioButtonList list = (RadioButtonList)Panel1.FindControl("cbk" + i.ToString());
                if (list != null)
                {
                    if (list.SelectedValue.ToString() != "")
                    {
                        msc += list.SelectedValue.ToString();//存储考生答案
                    }
                    else
                    {
                        msc += "0";//如果没有选择则为0
                    }
                }
            }
            Session["Sans"] = msc;//考生答案
            //更新考试结果数据表
            string sql = "update tb_score set RigthAns='" + Ans + "',StudentAns='" + msc + "' where StudentID='" + lblStuNum.Text + "'";

            BaseClass.OperateData(sql);
            Response.Redirect("result.aspx?BInt=" + tNUM.ToString());
        }
Ejemplo n.º 10
0
        protected List <double> calculateAverage()
        {
            string        conString = String.Format(@"Server=tcp:neredenyesek.database.windows.net,1433;Initial Catalog=Computerproject;Persist Security Info=False;User ID=serkanbekir;Password=serkan-94;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;");
            SqlConnection con       = new SqlConnection(conString);
            SqlCommand    cmd       = new SqlCommand();

            cmd.Connection = con;
            con.Open();
            string firstCommand = "SELECT COUNT(distinct ad) FROM RESTORANLAR;";

            cmd.CommandText = firstCommand;
            int    restoranSayisi = (int)cmd.ExecuteScalar();
            string secondCommand  = "SELECT COUNT(distinct id) FROM UYELER;";

            cmd.CommandText = secondCommand;
            int           uyeSayisi   = (int)cmd.ExecuteScalar();
            double        total       = 0;
            List <double> averageList = new List <double>();

            for (int i = 0; i < restoranSayisi; i++)
            {
                for (int j = i; j <= (uyeSayisi - 1) * restoranSayisi + i; j = j + restoranSayisi)
                {
                    string  id = "TextBox" + j.ToString();
                    TextBox tb = (TextBox)Panel1.FindControl(id);
                    total = total + Convert.ToDouble(tb.Text);
                }
                total = total / uyeSayisi;
                averageList.Add(total);
                total = 0;
            }
            return(averageList);
        }
Ejemplo n.º 11
0
    private void SetControlValue(DataTable dt)//设置控件值
    {
        for (int i = 0; i < dt.Columns.Count; i++)
        {
            try
            {
                Control c    = Panel1.FindControl("ext" + dt.Columns[i].ColumnName.Trim());
                string  type = c.GetType().Name.Trim();
                switch (type)
                {
                case "ComboBox":
                    ComboBox cbb = (ComboBox)c;
                    cbb.SelectedItem.Value = dt.Rows[0][i].ToString().Trim();
                    break;

                case "TextArea":
                    TextArea ta = (TextArea)c;
                    ta.Text = dt.Rows[0][i].ToString().Trim();
                    break;
                }
            }
            catch
            {
                continue;
            }
        }
    }
Ejemplo n.º 12
0
 private void SetDataFromControlToObject()
 {
     try
     {
         _TransferSavedList = new CustomList <TransferAndPromotionHistory>();
         foreach (EntityList M in _entityList)
         {
             ASL.Hr.DAO.TransferAndPromotionHistory TPH = new TransferAndPromotionHistory();
             TPH.EmpKey = Convert.ToInt64(hfEmpKey.Value);
             TransferAndPromotionHistory obj = _CurrentPosition.Find(f => f.EntityName == M.EntityName);
             TPH.PreHKEntryID   = obj.PreHKEntryID;
             TPH.PreHKEntryName = obj.PreHKEntryName;
             TPH.EntityID       = obj.EntityID;
             TPH.EntityName     = obj.EntityName;
             DropDownList ddl = (DropDownList)Panel1.FindControl("ddlPost" + M.EntityName.ToString());
             TPH.CurrentHKEntryID   = ddl.SelectedValue.ToInt();
             TPH.CurrentHKEntryName = ddl.SelectedItem.Text;
             TPH.EffectiveDate      = txtEffectiveDate.Text.ToDateTime();
             TPH.Type           = ddlTransferType.SelectedValue.ToInt();
             TPH.StatusType     = "Transfer";
             TPH.Remarks        = txtRemarks.Text;
             TPH.NextReviewDate = txtNextReviewDate.Text.ToDateTime();
             TPH.AddedBy        = CurrentUserSession.UserCode;
             TPH.AddedDate      = DateTime.Now;
             _TransferSavedList.Add(TPH);
         }
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
Ejemplo n.º 13
0
        public void MyDataBind()
        {
            CinemaLINQDataContext dt = new CinemaLINQDataContext();

            List <SuatChieu> _dsSuatChieu = (from _sc in dt.SuatChieus
                                             where _sc.LichChieuPhim.NgayChieu.Date >= DateTime.Now.Date && _sc.TinhTrang == true
                                             orderby _sc.MaPhim ascending
                                             select _sc).ToList();

            if (_dsSuatChieu.Count == 0)
            {
                return;
            }

            List <SuatChieu> _dsSuatChieuTheoPhim = new List <SuatChieu>();
            int _currentPhim = -1;

            for (int i = 0; i < _dsSuatChieu.Count; i++)
            {
                if (_dsSuatChieu[i].MaPhim != _currentPhim)
                {
                    _dsSuatChieuTheoPhim.Add(_dsSuatChieu[i]);
                    _currentPhim = _dsSuatChieu[i].MaPhim;
                }
            }

            //DataList _temp = (DataList)Panel1.FindControl("dtl_DanhSachPhim");
            ((DataList)Panel1.FindControl("dtl_DanhSachPhim")).DataSource = _dsSuatChieuTheoPhim;
            ((DataList)Panel1.FindControl("dtl_DanhSachPhim")).DataBind();
            //dtl_DanhSachPhim.DataSource = _dsSuatChieuTheoPhim;
            //dtl_DanhSachPhim.DataBind();
        }
Ejemplo n.º 14
0
    protected void ddlSchema_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (String.IsNullOrEmpty(ddlConn.SelectedValue))
        {
            return;
        }

        DAL dal = GetDAL();

        if (dal == null)
        {
            return;
        }

        String name = ddlSchema.SelectedValue;

        if (String.IsNullOrEmpty(name))
        {
            return;
        }

        // 计算约束条件
        String[]  pms = null;
        DataTable rdt = null;

        try
        {
            // SQLite不支持该集合
            rdt = dal.Session.GetSchema(DbMetaDataCollectionNames.Restrictions, null);
        }
        catch { }

        if (rdt != null)
        {
            DataRow[] drs = rdt.Select(String.Format("{0}='{1}'", DbMetaDataColumnNames.CollectionName, name));
            if (drs != null && drs.Length > 0)
            {
                pms = new String[drs.Length];
                for (int i = 0; i < drs.Length; i++)
                {
                    TextBox txt = Panel1.FindControl("txt" + drs[i][1].ToString()) as TextBox;
                    if (txt != null && !String.IsNullOrEmpty(txt.Text))
                    {
                        pms[i] = txt.Text;
                    }
                }
            }
        }

        DataTable dt = dal.Session.GetSchema(name, pms);

        if (dt != null)
        {
            gvTable.DataSource = dt;
            gvTable.DataBind();
        }
    }
Ejemplo n.º 15
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     Button2.Visible = true;
     for (int i = 0; i < 5; i++)
     {
         Literal littAnswer = (Literal)Panel1.FindControl("ltAnswer" + (i + 1).ToString());
         littAnswer.Visible = true;
     }
 }
Ejemplo n.º 16
0
    //交卷
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        int nom = Convert.ToInt32(Session["tNom"]);

        string[] Ans = new string[100];
        for (int i = 0; i <= xi; i++)
        {
            RadioButtonList list = (RadioButtonList)Panel1.FindControl("cbk" + x[i].ToString());
            if (list != null)
            {
                if (list.SelectedValue.ToString() != "")
                {
                    Ans[x[i]] = list.SelectedValue.ToString();//存储考生答案
                }
                else
                {
                    Ans[x[i]] = "";
                }
            }
        }
        for (int i = 0; i <= ti; i++)
        {
            TextBox txb = (TextBox)Panel1.FindControl("txbti" + t[i].ToString());
            if (txb != null)
            {
                if (txb.Text.ToString() != "")
                {
                    Ans[t[i]] = txb.Text.ToString();//存储考生答案
                }
                else
                {
                    Ans[t[i]] = "";
                }
            }
        }
        int score = 0;

        for (int a = 1; a <= nom; a++)
        {
            if (RightAns[a] == Ans[a])
            {
                score += 5;
            }
        }
        string        sqlstring = "insert into tb_Score (StudentID,Course,Score,ExamID) values ('" + lblID.Text + "','" + Session["KM"].ToString() + "'," + score + ",'" + ExamID + "')";
        SqlConnection conn      = new SqlConnection(getConnectionString());
        SqlCommand    com       = new SqlCommand(sqlstring, conn);

        conn.Open();
        if (com.ExecuteNonQuery() == 1)
        {
            Response.Write("<script>alert('总分:" + score + "')</script>");
            Response.Redirect("Student.aspx");
        }
    }
Ejemplo n.º 17
0
        private void PopulateEmpHKInfo(HRM_Emp emp)
        {
            CustomList <EmployeeHKInfo> EmpWiseHKInfoList = _empManager.GetAllEmployeeHKInfo(emp.EmpKey);

            foreach (EmployeeHKInfo eHKI in EmpWiseHKInfoList)
            {
                DropDownList ddl = new DropDownList();
                ddl = (DropDownList)Panel1.FindControl("ddl" + eHKI.HKName.ToString());
                ddl.SelectedValue = eHKI.HKID.ToString();
            }
        }
        protected void removePhone_Click(object sender, EventArgs e)
        {
            var box = PhoneHolder.Instance.RemoveLastElement();

            if (box != null)
            {
                Panel1.Controls.Remove(box);
                Label to = (Label)Panel1.FindControl(box.ID + "label");
                Panel1.Controls.Remove(to);
            }
        }
Ejemplo n.º 19
0
    protected void gv_Randomization_Tadpole_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
    {
        GridView gv = (GridView)Panel1.FindControl("gv_Randomization_Tadpole");

        Label lblError = (Label)Master.FindControl("lblInfoLog_Error");

        lblError.Text += "<br/><br/><br/>+++here at gv_Randomization_Tadpole_RowCancelingEdit  RowIndex = " + e.RowIndex.ToString() + "<br/>";

        e.Cancel     = true;
        gv.EditIndex = -1;
        gv.DataBind();
    }
        // One Function for removing any kind of control.
        private void RemoveControl(string id)
        {
            Control cntrl = Panel1.FindControl(id);

            if (Panel1.Controls.Contains(cntrl))
            {
                Panel1.Controls.Remove(cntrl);
            }
            // The extra <br> tag has to be removed as well.
            // Buggy implementation...

            // Solution = Change sequence. (Done)
        }
Ejemplo n.º 21
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (ViewState["BuildMyText"] != null && (bool)ViewState["BuildMyText"])
            {
                int       a  = (int)ViewState["NumberOfControls"];
                DataTable dt = new DataTable();
                dt.Columns.Add("optionText", typeof(string));
                dt.Columns.Add("optionDesc", typeof(string));
                for (int i = 0; i < a; i++)
                {
                    DataRow dr  = dt.NewRow();
                    string  lbl = "lbl" + array[i];
                    dr["optionText"] = (Panel1.FindControl(lbl) as Label).Text;
                    string txtbox = "txt" + (i + 1);
                    dr["optionDesc"] = (Panel1.FindControl(txtbox) as TextBox).Text;
                    dt.Rows.Add(dr);
                }

                DAL    dal         = new DAL();
                string insertQuery = @"
                                    INSERT INTO Question
                                    (
	                                    -- QuestionID -- this column value is auto-generated
	                                    [Description],
	                                    class,
	                                    Chapter,
	                                    CorrectOption,
	                                    [Subject]
                                    )
                                    VALUES
                                    ( '" + txtQuestion.Text + "','" + ddlClass.SelectedValue + "','" + ddlChapter.SelectedValue + "',	'"+ ddlCorrectAnswer.SelectedValue + "','" + ddlSubject.Text + "') SELECT SCOPE_IDENTITY()";

                int QuestionID = dal.insertDataWithReturnId(insertQuery);
                if (QuestionID > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        string query = @"INSERT INTO QuestionOption
                                        (
	                                        QuestionID,OptionID,OptionDesc
                                        )
                                        VALUES
                                        (" + QuestionID + ",'" + dr["optionText"] + "','" + dr["optionDesc"] + "')";
                        dal.insertData(query);
                    }
                }

                ViewState["NumberOfControls"] = null;
                ViewState["BuildMyText"]      = null;
            }
        }
Ejemplo n.º 22
0
    protected void gv_Randomization_Tadpole_RowEditing(object sender, GridViewEditEventArgs e)
    {
        GridView gv = (GridView)Panel1.FindControl("gv_Randomization_Tadpole");

        gv.EditIndex = e.NewEditIndex;
        gv.DataBind();
        Label lblError = (Label)Master.FindControl("lblInfoLog_Error");

        lblError.Text += "<br/><br/><br/>+++ here at gv_Randomization_Tadpole_RowEditing   newEditIndex = " + e.NewEditIndex.ToString() + "<br/>";

        GridViewRow row = gv.Rows[e.NewEditIndex];

        PrintRowControlsInfo(row);
    }
Ejemplo n.º 23
0
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        FileUpload FileUpload1 = (FileUpload)Panel1.FindControl("FileUpload1");

        if (FileUpload1.HasFile)
        {
            string FileName   = Path.GetFileName(FileUpload1.PostedFile.FileName);
            string Extension  = Path.GetExtension(FileUpload1.PostedFile.FileName);
            string FolderPath = ConfigurationManager.AppSettings["GeneEventsFolderPath"];
            string FilePath   = Server.MapPath(FolderPath + FileName);
            FileUpload1.SaveAs(FilePath);
            GetExcelSheets(FilePath, Extension, "True");
        }
    }
Ejemplo n.º 24
0
        private void ShowData(DataTable dt)
        {
            int num = 0;

            conName.Text             = dt.Rows[0]["PROJECT"].ToString();
            txtengnm.Text            = dt.Rows[0]["ENGINEER"].ToString();
            txtyz.Text               = dt.Rows[0]["YEZHU"].ToString();
            tbje.Text                = dt.Rows[0]["JINE"].ToString();
            Txtmeno.Text             = dt.Rows[0]["BP_NOTE"].ToString();
            HiddenFieldContent.Value = dt.Rows[0]["BC_CONTEXT"].ToString();
            string A = dt.Rows[0]["BC_REVIEWERA"].ToString();
            string B = dt.Rows[0]["BC_REVIEWERB"].ToString();
            string C = dt.Rows[0]["BC_REVIEWERC"].ToString();
            string D = dt.Rows[0]["BC_REVIEWERD"].ToString();
            string E = dt.Rows[0]["BC_REVIEWERE"].ToString();
            string G = dt.Rows[0]["BC_REVIEWERG"].ToString();
            string H = dt.Rows[0]["BC_REVIEWERH"].ToString();
            string I = dt.Rows[0]["BC_REVIEWERI"].ToString();
            string J = dt.Rows[0]["BC_REVIEWERJ"].ToString();

            num = G == "" ? num : num++;
            num = H == "" ? num : num++;
            num = I == "" ? num : num++;
            num = J == "" ? num : num++;
            Dictionary <int, string> subre = new Dictionary <int, string>();

            subre.Add(0, A);
            subre.Add(1, B);
            subre.Add(2, C);
            subre.Add(3, D);
            subre.Add(4, E);
            subre.Add(5, G);
            subre.Add(6, H);
            subre.Add(7, I);
            subre.Add(8, J);
            for (int i = 0; i < 5 + num; i++)
            {
                string       shenheren = subre.Values.ElementAt(i);
                CheckBoxList ck        = (CheckBoxList)Panel1.FindControl("cki" + i.ToString());
                for (int j = 0; j < ck.Items.Count; j++)
                {
                    if (ck.Items[j].Value == shenheren)
                    {
                        ck.Items[j].Selected = true;
                    }
                }
            }
        }
        /****************************对评审人进行勾选登记*************************************/
        private void bindReviewer()
        {
            int       count    = 0;
            string    sql_psbm = "select distinct dep_id,b.dep_name from TBCM_HT_SETTING as a left join TBDS_DEPINFO as b on a.dep_id=b.DEP_CODE";
            DataTable dt_psbm  = DBCallCommon.GetDTUsingSqlText(sql_psbm);

            for (int i = 0; i < dt_psbm.Rows.Count; i++)
            {
                CheckBoxList ck = (CheckBoxList)Panel1.FindControl("cki" + i.ToString());
                if (ck != null)
                {
                    for (int j = 0; j < ck.Items.Count; j++)
                    {
                        if (ck.Items[j].Selected == true)
                        {
                            reviewer.Add(count, ck.Items[j].Value.ToString());//字典,绑定部门领导的编号
                            count++;
                        }
                    }
                }
            }

            /**********对领导进行勾选===通过金额************/

            double cr_htje = Convert.ToDouble(TextJE.Text.Trim());

            ////取金额的绝对值
            //cr_htje = Math.Abs(cr_htje);

            //string sqltext = "select REV_PERNM,REV_PERID from POWER_REVIEW where REV_CATEGORY='" + ddl_htlx.SelectedValue + "' and REV_MINAM<=" + cr_htje + " and REV_MAXAM>" + cr_htje + "";

            //DataTable dt = DBCallCommon.GetDTUsingSqlText(sqltext);

            //if (dt.Rows.Count > 0)
            //{
            //    for (int i = 0; i < dt.Rows.Count; i++)
            //    {
            //        reviewer_LD.Add(i, dt.Rows[i]["REV_PERID"].ToString());//字典,绑定的领导的编号
            //    }
            //}
            //else
            //{
            //    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('找不到对应的审批领导!!!\\r请检查合同金额与合同类型!');", true);//对应的金额在领导合同审批相应的区间找不到人
            //    return;
            //}
        }
Ejemplo n.º 26
0
    protected void SqlDataSource1_Inserting(object sender, SqlDataSourceCommandEventArgs e)
    {
        DropDownList başlıkDropDownList = (DropDownList)Panel1.FindControl("DropDownList1");
        int          anaBaşlıkId        = Convert.ToInt32(başlıkDropDownList.SelectedValue);
        string       başlıkİsmi         = Convert.ToString(başlıkDropDownList.SelectedItem);

        FileUpload pdfFileUpload  = (FileUpload)DetailsView1.FindControl("pdfFileUpload");
        string     virtualFolder  = "~/PdfFiles/" + başlıkİsmi + "/";
        string     physicalFolder = Server.MapPath(virtualFolder);
        string     fileName       = Guid.NewGuid().ToString();
        string     extension      = System.IO.Path.GetExtension(pdfFileUpload.FileName);

        pdfFileUpload.SaveAs(System.IO.Path.Combine(physicalFolder, fileName + extension));

        // "FileUrl" InsertParametresi buradan gönderiliyor.
        e.Command.Parameters["@FileUrl"].Value = virtualFolder + fileName + extension;
    }
Ejemplo n.º 27
0
        protected void btnAddVotes_Click(object sender, EventArgs e)
        {
            string        conString = String.Format(@"Server=tcp:neredenyesek.database.windows.net,1433;Initial Catalog=Computerproject;Persist Security Info=False;User ID=serkanbekir;Password=serkan-94;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;");
            SqlConnection con       = new SqlConnection(conString);
            SqlCommand    cmd       = new SqlCommand();

            cmd.Connection = con;
            con.Open();
            string deleteSchedule = "DELETE FROM TAKVIM;";

            cmd.CommandText = deleteSchedule;
            cmd.ExecuteNonQuery();
            int           counter = 0;
            List <double> list    = new List <double>();

            list = calculateAverage();
            List <int> idlist = new List <int>();

            idlist = getIds();


            for (int i = 0; i < list.Count; i++)
            {
                int    id           = idlist[counter];
                string firstCommand = "UPDATE PUANLAR SET puan=puan+" + list[i].ToString() + " WHERE restoranid=" + id + ";";
                cmd.CommandText = firstCommand;
                cmd.ExecuteNonQuery();
                counter++;
            }

            string secondCommand = "UPDATE RESTORANLAR SET isVoted=1;";

            cmd.CommandText = secondCommand;
            cmd.ExecuteNonQuery();

            TextBox tbox         = (TextBox)Panel1.FindControl("Textboxcycle");
            string  cyclelength  = tbox.Text.ToString();
            string  thirdCommand = "UPDATE PUANLAR SET cyclelength=" + cyclelength + ";";

            cmd.CommandText = thirdCommand;
            cmd.ExecuteNonQuery();
            con.Close();

            Response.Redirect("~/");
            return;
        }
Ejemplo n.º 28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //SqlConnection con = new SqlConnection(@"Data Source=HIBAMANAGE;Initial Catalog=test;Integrated Security=True");
            SqlConnection con = new SqlConnection();

            con.ConnectionString = ConfigurationManager.ConnectionStrings["DBConnection"].ToString();
            SqlDataAdapter sda = new SqlDataAdapter("select * from test1", con);

            DataTable dt = new DataTable();

            sda.Fill(dt);

            for (int i = 13; i >= 16; i++)
            {
                Image img = (Image)Panel1.FindControl("List" + i);
                img.ImageUrl = dt.Rows[i]["imagePath"].ToString();
            }
        }
Ejemplo n.º 29
0
        private void btnGravar_Click(Object sender, System.EventArgs e)
        {
            var listaTemplateDoBancoDeDados = ListarTodos();

            try
            {
                var listaTemplateAlterada = new List <Template>();

                foreach (Control controle in Panel1.Controls)
                {
                    if (controle.GetType().Name.Trim().ToLower().Equals("ckeditorcontrol"))
                    {
                        var ckControl = (CKEditorControl)controle;

                        var idTextBox = int.Parse(controle.ID.Split('_')[1]);

                        var template = ObterObjetoTemplate(idTextBox, listaTemplateDoBancoDeDados);

                        var assunto = (TextBox)Panel1.FindControl("txt_assunto_" + idTextBox);

                        if (assunto != null)
                        {
                            template.Assunto = assunto.Text;
                        }

                        if (!string.IsNullOrWhiteSpace(ckControl.Text))
                        {
                            template.TextoTemplate = ckControl.Text;
                            listaTemplateAlterada.Add(template);
                        }
                    }
                }

                var manterTemplate = new ManterTemplate();
                //Salva as informações obtidas, dinamicamente.
                manterTemplate.IncluirTemplate(listaTemplateAlterada);

                WebFormHelper.ExibirMensagem(enumTipoMensagem.Sucesso, "Informações sobre os Templates do Sistema Alterados com Sucesso !");
            }
            catch (AcademicoException ex)
            {
                WebFormHelper.ExibirMensagem(enumTipoMensagem.Erro, ex.Message);
            }
        }
        private bool Check_MustPutIN()
        {
            bool check = true;
            int  count = 0;

            for (int i = 0; i < 7; i++)
            {
                CheckBoxList ck = (CheckBoxList)Panel1.FindControl("cki" + i.ToString());
                if (ck != null)
                {
                    for (int j = 0; j < ck.Items.Count; j++)
                    {
                        if (ck.Items[j].Selected == true)
                        {
                            count++;
                        }
                    }
                }
            }
            if (count == 0)
            {
                check = false;
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('您还没有选择审批人!');", true); return(check);
            }
            if (txt_zdrYJ.Text.Trim() == "")
            {
                check = false;
                ScriptManager.RegisterStartupScript(this.Page, GetType(), "", "alert('没有填写制单人意见!!');", true); return(check);
            }
            if (ddl_htlx.SelectedIndex == 0)
            {
                check = false;
                ScriptManager.RegisterStartupScript(this.Page, GetType(), "", "alert('请选择合同类型!!');", true); return(check);
            }

            if (!tb_conid.Text.Trim().Contains('-'))
            {
                check = false;
                ScriptManager.RegisterStartupScript(this.Page, GetType(), "", "alert('为区分于主合同,请在补充协议编号后加上【-1】、【-2】等!!');", true); return(check);
            }

            return(check);
        }