protected void FormView1_ItemInserted(object sender, FormViewInsertedEventArgs e)
 {
     GridView1.DataBind();
 }
 protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
 {
     GridView1.DataSource = context.Suppliers.ToList();
     GridView1.EditIndex  = e.NewEditIndex;
     GridView1.DataBind();
 }
        protected void Button1_Click(object sender, EventArgs e)
        {
            VWCTSDataContext db = new VWCTSDataContext();
            var queryResults    = from n in db.Histories
                                  where n.Type == "Initial Delivery"
                                  select n;

            if (tbCarID.Text != "")
            {
                int id = 0;
                if (!int.TryParse(tbCarID.Text, out id))
                {
                    lblCarID.ForeColor = System.Drawing.Color.Red;
                    return;
                }

                queryResults = from n in queryResults
                               where id == n.Car_ID
                               select n;
            }

            if (tbCustomerID.Text != "")
            {
                int id = 0;
                if (!int.TryParse(tbCustomerID.Text, out id))
                {
                    lblCustomerID.ForeColor = System.Drawing.Color.Red;
                    return;
                }

                queryResults = from n in queryResults
                               where id == n.Customer_ID
                               select n;
            }

            if (tbVIN.Text != "")
            {
                var carID = (from n in db.Cars
                             where n.VIN == tbVIN.Text
                             select n.Car_ID).Single();

                queryResults = from n in queryResults
                               where carID == n.Car_ID
                               select n;
            }

            if (tbLastName.Text != "")
            {
                var customerID = (from n in db.Customers
                                  where tbLastName.Text == n.Last_Name
                                  select n.Customer_ID).Single();

                queryResults = from n in queryResults
                               where customerID == n.Customer_ID
                               select n;
            }

            var gridSource = from n in queryResults
                             join p in db.Customers on n.Customer_ID equals p.Customer_ID
                             join q in db.Cars on n.Car_ID equals q.Car_ID
                             orderby n.Date ascending
                             select new
            {
                Customer    = n.Customer_ID,
                Name        = string.Concat(p.Last_Name, ", ", p.First_Name),
                Car         = n.Car_ID,
                Model       = q.Model,
                Trim        = q.Trim,
                Date        = n.Date,
                Type        = n.Type,
                Description = n.Description
            };

            GridView1.DataSource  = gridSource;
            Session["DataSource"] = queryResults;
            GridView1.DataBind();
        }
 protected void Button1_Click(object sender, EventArgs e)
 {
   SqlDataSource2.DataBind();
   GridView1.DataBind();
 }
Example #5
0
        protected void btn_ok_Click(object sender, EventArgs e)
        {
            btn_ok.Visible = false;
            Boolean bool_isexist = db_opt.IsRecordExist("[dzsw].[dbo].[Syl_WorkerInfo]", "IDCard", tbx_IDCard.Text.Trim());

            if (option_sql != "")
            {
                option_sql = "";
            }
            try
            {
                Boolean bool_idcardFormat = Regex.IsMatch(tbx_IDCard.Text.Trim(), @"^\d{15}$") && tbx_IDCard.Text.Length == 15 || Regex.IsMatch(tbx_IDCard.Text.Trim(), @"^\d{17}[0-9Xx]$") && tbx_IDCard.Text.Length == 18;

                if (bool_idcardFormat == false)
                {
                    throw new Exception("身份证号: " + tbx_IDCard.Text.Trim());
                }
                if (Regex.IsMatch(tbx_SalaryCoefficient.Text, @"^\d{1,}$|^\d{1,}.\d{1,}$") == false)
                {
                    throw new Exception("工资系数: " + tbx_SalaryCoefficient.Text);
                }
                if (Regex.IsMatch(tbx_DutyCoefficient.Text, @"^\d{1,}$|^\d{1,}.\d{1,}$") == false)
                {
                    throw new Exception("管理奖系统:" + tbx_DutyCoefficient.Text);
                }



                if (string.Compare(option_method, "insert") == 0 && !bool_isexist)
                {
                    option_sql = "insert into [dzsw].[dbo].[Syl_WorkerInfo] (WorkerName,IDCard,GroupName,Job,Duties,SalaryCoefficient,DutyCoefficient,Is_PaiQian)values('"
                                 + tbx_WorkerName.Text + "','" + tbx_IDCard.Text.Trim() + "','"
                                 + tbx_GroupName.Text + "','" + tbx_Job.Text + "','" + tbx_Duties.Text + "','"
                                 + Convert.ToDecimal(tbx_DutyCoefficient.Text.Trim()) + "','"
                                 + Convert.ToDecimal(tbx_DutyCoefficient.Text.Trim()) + "','"
                                 + ddl_is_paiqian.SelectedItem.Text + "')";
                }
                else
                if (string.Compare(option_method, "insert") == 0 && bool_isexist)
                {
                    throw new Exception("用户已经存在: " + tbx_IDCard.Text.Trim());
                }

                if (string.Compare(option_method, "delete") == 0 && bool_isexist)
                {
                    option_sql = "delete  from [dzsw].[dbo].[Syl_WorkerInfo] where  ID='" + tbx_id.Text + "'";
                }
                else
                if (string.Compare(option_method, "delete") == 0 && !bool_isexist)
                {
                    throw new Exception("用户不存在: " + tbx_IDCard.Text.Trim());
                }

                if (string.Compare(option_method, "update") == 0 && bool_isexist)
                {
                    option_sql = "update  [dzsw].[dbo].[Syl_WorkerInfo] set WorkerName='" + tbx_WorkerName.Text.Trim()
                                 + "',IDCard='" + tbx_IDCard.Text.Trim()
                                 + "',GroupName='" + tbx_GroupName.Text.Trim() + "',Job='" + tbx_Job.Text.Trim() + "',Duties='" + tbx_Duties.Text.Trim()
                                 + "',SalaryCoefficient='" + Convert.ToDecimal(tbx_SalaryCoefficient.Text.Trim())
                                 + "',DutyCoefficient='" + Convert.ToDecimal(tbx_DutyCoefficient.Text.Trim())
                                 + "',Is_PaiQian='" + ddl_is_paiqian.SelectedItem.Text
                                 + "' where id='" + tbx_id.Text.Trim() + "'";
                }
                else
                if (string.Compare(option_method, "update") == 0 && !bool_isexist)
                {
                    throw new Exception("用户不存在: " + tbx_IDCard.Text.Trim());
                }

                if (option_sql != "")
                {
                    db_opt.execsql(option_sql);
                    GridView1.DataSource = db_opt.build_dataset(sel_string);
                    GridView1.DataBind();
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "message", "<script>alert('数据已经同步!');</script>");
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "message", "<script>alert('无效操作!');</script>");
                }


                employer_detail.Visible = false;
            }
            catch (Exception opt_err)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "message", "<script>alert('录入字段类型或格式错误! " + opt_err.Message.ToString() + "');</script>");
            }
        }
Example #6
0
 protected void GridView1_RowEditing1(object sender, GridViewEditEventArgs e)
 {
     GridView1.EditIndex  = e.NewEditIndex;
     GridView1.DataSource = kn.laydata("SELECT * FROM Admin");
     GridView1.DataBind();
 }
Example #7
0
        protected void btnSend_Click(object sender, EventArgs e)
        {
            if (ddlTypeuser.Text == "Single User")
            {
                con.Open();
                MySqlCommand cmd = con.CreateCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = @"INSERT INTO `mailbox`( `sender_username`, `sender_name`, `reciver_username`, `reciver_name`, `subject`, `message`,`DateTime`) VALUES
               ('" + sponsor_username + "','" + sponsor_name + "','" + ddlUser.Text + "','" + lblName.Text + "','" + txtSubject.Text + "','" + message.Value + "','" + DateTime.Now + "')";
                cmd.ExecuteNonQuery();
                con.Close();

                con.Open();
                MySqlCommand cmdl = con.CreateCommand();
                cmdl.CommandType = System.Data.CommandType.Text;
                cmdl.CommandText = @"INSERT INTO `send_mail`( `DateTime`, `sender_username`, `sender_name`, `receiver_username`, `receiver_name`, `subject`, `message`) VALUES
               ('" + DateTime.Now + "','" + sponsor_username + "','" + sponsor_name + "','" + ddlUser.Text + "','" + lblName.Text + "','" + txtSubject.Text + "','" + message.Value + "')";
                cmdl.ExecuteNonQuery();
                con.Close();

                ddlUser.SelectedIndex = -1;
                message.Value         = "";
                txtSubject.Text       = "";
                Response.Write("<script>alert('Message Send!!')</script>");
            }
            else
            {
                con.Open();
                MySqlCommand cmd = con.CreateCommand();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "Select  username,client_name from add_new_member where username!='" + sponsor_username + "' ";
                cmd.ExecuteNonQuery();
                DataTable        dt  = new DataTable();
                MySqlDataAdapter sda = new MySqlDataAdapter(cmd);
                sda.Fill(dt);
                foreach (DataRow drs in dt.Rows)
                {
                    lblUsername.Text = drs["username"].ToString();
                    lblName.Text     = drs["client_name"].ToString();

                    con.Close();
                    con.Open();
                    MySqlCommand cmdh = con.CreateCommand();
                    cmdh.CommandType = System.Data.CommandType.Text;
                    cmdh.CommandText = @"INSERT INTO `mailbox`( `sender_username`, `sender_name`, `reciver_username`, `reciver_name`, `subject`, `message`,`DateTime`) VALUES
               ('" + sponsor_username + "','" + sponsor_name + "','" + lblUsername.Text + "','" + lblName.Text + "','" + txtSubject.Text + "','" + message.Value + "','" + DateTime.Now + "')";
                    cmdh.ExecuteNonQuery();
                    con.Close();
                }
                con.Close();

                con.Open();
                MySqlCommand cmd3 = con.CreateCommand();
                cmd3.CommandType = System.Data.CommandType.Text;
                cmd3.CommandText = @"INSERT INTO `send_mail`( `DateTime`, `sender_username`, `sender_name`, `receiver_username`, `receiver_name`, `subject`, `message`) VALUES
               ('" + DateTime.Now + "','" + sponsor_username + "','" + sponsor_name + "','ALL','ALL','" + txtSubject.Text + "','" + message.Value + "')";
                cmd3.ExecuteNonQuery();
                con.Close();
                ddlUser.SelectedIndex = -1;
                message.Value         = "";
                txtSubject.Text       = "";
                Response.Write("<script>alert('Message Send To All Users!!')</script>");
            }

            con.Open();
            MySqlCommand cmd1 = con.CreateCommand();

            cmd1.CommandText = "Select * From send_mail where sender_username='******'";
            cmd1.Connection  = con;
            MySqlDataAdapter sda1 = new MySqlDataAdapter(cmd1);
            DataSet          ds1  = new DataSet();

            sda1.SelectCommand = cmd1;
            sda1.Fill(ds1, "send_mail");
            GridView1.DataSource = ds1;
            GridView1.DataBind();
            con.Close();
        }
Example #8
0
    public void BindData()
    {
        GridView1.DataSource       = GetMostrePaged(GridView1.PageIndex, GridView1.PageSize);
        GridView1.VirtualItemCount = GetMostreCount();
        lcount.Text = GridView1.VirtualItemCount + " mostre";
        GridView1.DataBind();

        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            try
            {
                if (GridView1.Rows[i].Cells[5].Text.Trim() != "" && !GridView1.Rows[i].Cells[5].Text.StartsWith("&nbsp;"))
                {
                    if (UMostre.VerificGrasime(GridView1.Rows[i].Cells[5].Text) == 1)
                    {
                        GridView1.Rows[i].Cells[5].BackColor = Color.Red;
                    }
                    string grasime = GridView1.Rows[i].Cells[5].Text.Trim();
                    GridView1.Rows[i].Cells[5].Text = (Convert.ToDouble(grasime, CultureInfo.InvariantCulture) == 0) ? "" : (Convert.ToDouble(grasime, CultureInfo.InvariantCulture) == 0.00001) ? "0" : grasime;
                }
                if (GridView1.Rows[i].Cells[6].Text.Trim() != "" && !GridView1.Rows[i].Cells[6].Text.StartsWith("&nbsp;"))
                {
                    if (UMostre.VerificProteine(GridView1.Rows[i].Cells[6].Text) == 1)
                    {
                        GridView1.Rows[i].Cells[6].BackColor = Color.Red;
                    }
                    string proteine = GridView1.Rows[i].Cells[6].Text.Trim();
                    GridView1.Rows[i].Cells[6].Text = (Convert.ToDouble(proteine, CultureInfo.InvariantCulture) == 0) ? "" : (Convert.ToDouble(proteine, CultureInfo.InvariantCulture) == 0.00001) ? "0" : proteine;
                }

                if (GridView1.Rows[i].Cells[7].Text.Trim() != "" && !GridView1.Rows[i].Cells[7].Text.StartsWith("&nbsp;"))
                {
                    string cazeina = GridView1.Rows[i].Cells[7].Text.Trim();
                    GridView1.Rows[i].Cells[7].Text = (Convert.ToDouble(cazeina, CultureInfo.InvariantCulture) == 0) ? "" : (Convert.ToDouble(cazeina, CultureInfo.InvariantCulture) == 0.00001) ? "0" : cazeina;
                }

                if (GridView1.Rows[i].Cells[8].Text.Trim() != "" && !GridView1.Rows[i].Cells[8].Text.StartsWith("&nbsp;"))
                {
                    if (UMostre.VerificLactoza(GridView1.Rows[i].Cells[8].Text) == 1)
                    {
                        GridView1.Rows[i].Cells[8].BackColor = Color.Red;
                    }
                    string lactoza = GridView1.Rows[i].Cells[8].Text.Trim();
                    GridView1.Rows[i].Cells[8].Text = (Convert.ToDouble(lactoza, CultureInfo.InvariantCulture) == 0) ? "" : (Convert.ToDouble(lactoza, CultureInfo.InvariantCulture) == 0.00001) ? "0" : lactoza;
                }

                if (GridView1.Rows[i].Cells[9].Text.Trim() != "" && !GridView1.Rows[i].Cells[9].Text.StartsWith("&nbsp;"))
                {
                    if (UMostre.VerificSolids(GridView1.Rows[i].Cells[9].Text) == 1)
                    {
                        GridView1.Rows[i].Cells[9].BackColor = Color.Red;
                    }
                    string substu = GridView1.Rows[i].Cells[9].Text.Trim();
                    GridView1.Rows[i].Cells[9].Text = (Convert.ToDouble(substu, CultureInfo.InvariantCulture) == 0) ? "" : (Convert.ToDouble(substu, CultureInfo.InvariantCulture) == 0.00001) ? "0" : substu;
                }
                //ph
                if (GridView1.Rows[i].Cells[10].Text.Trim() != "" && !GridView1.Rows[i].Cells[10].Text.StartsWith("&nbsp;"))
                {
                    if (UMostre.VerificPh(GridView1.Rows[i].Cells[10].Text) == 1)
                    {
                        GridView1.Rows[i].Cells[10].BackColor = Color.Red;
                    }
                    string ph = GridView1.Rows[i].Cells[10].Text.Trim();
                    GridView1.Rows[i].Cells[10].Text = (Convert.ToDouble(ph, CultureInfo.InvariantCulture) == 0) ? "" : (Convert.ToDouble(ph, CultureInfo.InvariantCulture) == 0.00001) ? "0" : ph;
                }

                //urea
                if (GridView1.Rows[i].Cells[11].Text.Trim() != "" && !GridView1.Rows[i].Cells[11].Text.StartsWith("&nbsp;"))
                {
                    string urea = GridView1.Rows[i].Cells[11].Text.Trim();
                    if ((Convert.ToDouble(urea, CultureInfo.InvariantCulture) >= 0.1) && UMostre.VerificUrea(urea) == 1)
                    {
                        GridView1.Rows[i].Cells[11].BackColor = Color.Red;
                    }
                    GridView1.Rows[i].Cells[11].Text = (Convert.ToDouble(urea, CultureInfo.InvariantCulture) == 0) ? "" : (Convert.ToDouble(urea, CultureInfo.InvariantCulture) == 0.00001) ? "" : (Convert.ToDouble(urea, CultureInfo.InvariantCulture) < 0.1) ? "" : urea;
                }

                if (GridView1.Rows[i].Cells[12].Text.Trim() != "" && !GridView1.Rows[i].Cells[12].Text.StartsWith("&nbsp;"))
                {
                    if (UMostre.VerificNCS(GridView1.Rows[i].Cells[12].Text) == 1)
                    {
                        GridView1.Rows[i].Cells[12].BackColor = Color.Red;
                    }
                    string ncs = GridView1.Rows[i].Cells[12].Text.Trim();
                    GridView1.Rows[i].Cells[12].Text = (Convert.ToDouble(ncs, CultureInfo.InvariantCulture) == 0) ? "" : (Convert.ToDouble(ncs, CultureInfo.InvariantCulture) == 0.00001) ? "0" : ncs;
                }
            }
            catch (Exception ex)
            {
                logger.Error(string.Format("BindData|ERROR:{0}", ex.Message));
            }
        }
    }
Example #9
0
 protected void btnSearch_Click(object sender, EventArgs e)
 {
     GridView1.DataBind();
 }
    private DataTable bind_data1()
    {
        string sql = "";

        //string sql_combine = "";
        //string sql_combine1 = "";

        for (int i = 0; i <= date_diff() - 1; i++)
        {
            if (i == 0)
            {
                sql = " SELECT '1'+ot1.date+ot1.empno as sn,'1' as type,'做六休一'as type_name, SUBSTRING(ot1.date,1,4)as year,SUBSTRING(ot1.date,5,2)as month,'0'as week,ot1.date, ot2.BUname, ot2.DIVname, ot2.name, ot1.empno, ot1.name AS                                                    " +
                      "                                empname, ot1.days_workcontinue ,'OPEN'as status,''as category ,'' as description FROM (SELECT                                                    " +
                      "                                DISTINCT CONVERT(varchar(12), t1e, 112) AS date,                                               " +
                      "                                empno, name, t1s, t1e, days_workcontinue,                                                      " +
                      "                                deptcode FROM dbo.View_WorkHourByCard WHERE                                                    " +
                      "                                (days_workcontinue > 6)                                                                        " +
                      "                                                                                                                               " +
                      "                               )                                                                                               " +
                      "                               AS ot1 INNER JOIN                                                                               " +
                      "                               (SELECT         TOP 100 PERCENT BUname, DIVcode, DIVname, deptcode,  name                       " +
                      "                                FROM              dbo.View_corporganization                                                " +
                      "                                WHERE          (DIVcode IN ('8N110000', '8N230000', '8CCL0000', '8N410000')))                  " +
                      //"                                AS ot2 ON ot1.deptcode = ot2.deptcode AND ot1.date = '20100704' AND ot1.deptcode = '8CCLA002'  "+
                      "                                AS ot2 ON ot1.deptcode = ot2.deptcode AND ot1.date = '" + txtEstimateStartDate.SelectedDate.Value.AddDays(+i).ToString("yyyy/MM/dd").Replace("/", "") + "'   " +
                      "                                                                               ";
                //sql_combine = "select * from ( " + sql + ")";
            }
            else
            {
                sql = sql + " UNION  all ";
                sql = sql + " SELECT '1'+ot1.date+ot1.empno as sn,'1' as type,'做六休一'as type_name, SUBSTRING(ot1.date,1,4)as year,SUBSTRING(ot1.date,5,2)as month,'0'as week,ot1.date, ot2.BUname, ot2.DIVname, ot2.name, ot1.empno, ot1.name AS                                                    " +
                      "                                empname, ot1.days_workcontinue ,'OPEN'as status,''as category ,'' as description FROM (SELECT                                                    " +
                      "                                DISTINCT CONVERT(varchar(12), t1e, 112) AS date,                                               " +
                      "                                empno, name, t1s, t1e, days_workcontinue,                                                      " +
                      "                                deptcode FROM dbo.View_WorkHourByCard WHERE                                                    " +
                      "                                (days_workcontinue > 6)                                                                        " +
                      "                                                                                                                               " +
                      "                               )                                                                                               " +
                      "                               AS ot1 INNER JOIN                                                                               " +
                      "                               (SELECT         TOP 100 PERCENT BUname, DIVcode, DIVname, deptcode,  name                       " +
                      "                                FROM              dbo.View_corporganization                                                " +
                      "                                WHERE          (DIVcode IN ('8N110000', '8N230000', '8CCL0000', '8N410000')))                  " +
                      //"                                AS ot2 ON ot1.deptcode = ot2.deptcode AND ot1.date = '20100704' AND ot1.deptcode = '8CCLA002'  "+
                      "                                AS ot2 ON ot1.deptcode = ot2.deptcode AND ot1.date = '" + txtEstimateStartDate.SelectedDate.Value.AddDays(+i).ToString("yyyy/MM/dd").Replace("/", "") + "'   " +
                      "                                                                                ";
            }
        }

        ds_temp = func.get_dataSet_access(sql, conn);

        GridView1.DataSource = ds_temp.Tables[0];
        GridView1.DataBind();

        #region delete_file
        //delete_data1();
        #endregion

        #region insert_file
        insert_data1(ds_temp.Tables[0]);
        #endregion



        return(ds_temp.Tables[0]);
    }
Example #11
0
 protected void C1Pager1_PageIndexChanged(object sender, EventArgs e)
 {
     GridView1.PageIndex = C1Pager1.PageIndex;
     GridView1.DataBind();
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     GridView1.DataBind();
 }
Example #13
0
    protected void fillgrid()
    {
        DataTable dt_s = new DataTable();
        string    str1 = "";

        if (DropDownList1.SelectedValue != "0")
        {
            str1 += "and VacancyPositionTitleMaster.ID=" + DropDownList1.SelectedValue + "";
        }
        if (DropDownList2.SelectedIndex > 0)
        {
            str1 += "and CountryMaster.CountryId=" + DropDownList2.SelectedValue + "";
        }
        if (DropDownList3.SelectedIndex > 0)
        {
            str1 += "and StateMasterTbl.StateId=" + DropDownList3.SelectedValue + "";
        }
        if (DropDownList4.SelectedIndex > 0)
        {
            str1 += "and CityMasterTbl.CityId=" + DropDownList4.SelectedValue + "";
        }
        //if (TextBox1.Text != "" && TextBox2.Text != "")
        //{
        //    str1 += " and CandidateMaster.EffectiveFrom between '" + TextBox1.Text + "' and '" + TextBox2.Text + "'";
        //}
        //if (TextBox3.Text != "")
        //{
        //    str1 += " and  candidatemaster.FirstName  like '%" + TextBox3.Text.Replace("'", "''") + "%'";
        //}
        if (CheckBox1.Checked == true)
        {
            string grid1 = @"select distinct  ShortListcandidates.Candidate_id as CandidateID,candidatemaster.LastName + ' ' + candidatemaster.FirstName + ' ' + candidatemaster.MiddleName as Candidate, " +
                           "VacancyPositionTitleMaster.VacancyPositionTitle,VacancyPositionTitleMaster.ID,ShortListcandidates.candidate_code,  " +
                           "ShortListcandidates.test_center_code from [jobcenter.OADB_Developer].[dbo].ShortListcandidates  " +
                           "inner join candidatemaster on candidatemaster.CandidateId =ShortListcandidates.Candidate_id  " +
                           "inner join VacancyPositionTitleMaster  on VacancyPositionTitleMaster.ID= ShortListcandidates.Vacancy_id  " +
                           "inner join CountryMaster on candidatemaster.CountryId=CountryMaster.CountryId  " +
                           "inner join StateMasterTbl on candidatemaster.StateId=StateMasterTbl.StateId  " +
                           "inner join CityMasterTbl on candidatemaster.City=CityMasterTbl.CityId   where ShortListcandidates.Active='Yes'   " + str1 + "";
            SqlDataAdapter da = new SqlDataAdapter(grid1, con);
            dt_s = new DataTable();
            da.Fill(dt_s);
            if (dt_s.Rows.Count > 0)
            {
                Panel3.Visible = true;
                //Button1.Visible = false;
                Button2.Visible = false;
                Label2.Visible  = true;
                // Button9.Visible = true;
                // pnlgrid.Visible = false;
                GridView2.DataSource = dt_s;
                GridView2.DataBind();
            }

            else
            {
                GridView2.DataSource = null;
                GridView2.DataBind();
                Label2.Visible = true;
                // Button9.Visible = true;
                //Panel22.Visible = false;
                //pnlgrid.Visible = false;
            }
        }
        else
        {
            string grid = "select distinct  ShortListcandidates.Candidate_id as CandidateID,VacancyPositionTitleMaster.VacancyPositionTitle,VacancyPositionTitleMaster.ID , " +
                          "candidatemaster.LastName + ' ' + candidatemaster.FirstName + ' ' + candidatemaster.MiddleName as Candidate,  " +
                          "CityMasterTbl.CityName+'  '+StateMasterTbl.StateName+'  '+CountryMaster.CountryName as location,ShortListcandidates.Note  " +
                          "from ShortListcandidates   " +
                          "inner join candidatemaster on candidatemaster.CandidateId =ShortListcandidates.Candidate_id   " +
                          "inner join VacancyPositionTitleMaster  on VacancyPositionTitleMaster.ID= ShortListcandidates.Vacancy_id    " +
                          "inner join  CountryMaster on candidatemaster.CountryId=CountryMaster.CountryId   " +
                          "inner join StateMasterTbl on candidatemaster.StateId=StateMasterTbl.StateId  " +
                          "inner join CityMasterTbl on candidatemaster.City=CityMasterTbl.CityId  where  VacancyPositionTitleMaster.Active=1  " + str1 + "";
            SqlDataAdapter da = new SqlDataAdapter(grid, con);
            DataTable      dt = new DataTable();
            da.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                for (int k = 0; k < dt.Rows.Count; k++)
                {
                    string         str3 = @"select Candidate_id,Vacancy_id from ShortListcandidates where Vacancy_id='" + dt.Rows[k][2].ToString() + "' and  ShortListcandidates.User_id='" + Session["Comid"].ToString() + "' and ShortListcandidates.Candidate_id='" + dt.Rows[k][0].ToString() + "'";
                    SqlDataAdapter da1  = new SqlDataAdapter(str3, con);
                    DataTable      dt1  = new DataTable();
                    da1.Fill(dt1);
                    if (dt1.Rows.Count < 1)
                    {
                        if (dt_s.Rows.Count < 1)
                        {
                            //dt_s.Columns.Add("image");
                            //dt_s.Columns.Add("CandidateID");
                            dt_s.Columns.Add("VacancyPositionTitle");
                            dt_s.Columns.Add("Candidate");
                            dt_s.Columns.Add("CandidateID");
                            dt_s.Columns.Add("Location");
                            dt_s.Columns.Add("vacancyid");
                            // dt_s.Columns.Add("EffectiveFrom");
                            // dt_s.Columns.Add("DocumentId");
                            //dt_s.Columns.Add("vacancyid");

                            //dt_s.Columns.Add("vid");
                        }
                        DataRow dr = dt_s.NewRow();
                        //dr["image"] = dt.Rows[k][0].ToString();
                        //dr["CandidateID"] = dt.Rows[k][1].ToString();
                        dr["VacancyPositionTitle"] = dt.Rows[k][1].ToString();
                        dr["Candidate"]            = dt.Rows[k][3].ToString();
                        dr["Location"]             = dt.Rows[k][4].ToString();
                        dr["CandidateID"]          = dt.Rows[k]["CandidateID"].ToString();
                        dr["vacancyid"]            = dt.Rows[k]["ID"].ToString();
                        //dr["EffectiveFrom"] = dt.Rows[k][6].ToString();
                        // dr["DocumentId"] = dt.Rows[k][7].ToString();
                        // dr["vacancyid"] = dt.Rows[k][8].ToString();

                        //dr["vid"] = dt.Rows[k][10].ToString();


                        dt_s.Rows.Add(dr);
                    }
                }
            }

            if (dt_s.Rows.Count > 0)
            {
                Panel2.Visible       = true;
                GridView1.DataSource = dt_s;
                GridView1.DataBind();


                //Panel22.Visible = false;
                //pnlgrid.Visible = true;
                //foreach (GridViewRow ggg in GridView1.Rows)
                //{
                //    Image Image100 = (Image)ggg.FindControl("Image11236");
                //    Image100.ImageUrl = "~\\ShoppingCart\\images\\" + Image100.ImageUrl;
                //}
            }


            else
            {
                Panel2.Visible       = false;
                GridView1.DataSource = null;
                GridView1.DataBind();
                Panel3.Visible = false;



                //Panel22.Visible = false;
                //pnlgrid.Visible = false;
            }
        }
    }
 protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     GridView1.PageIndex  = e.NewPageIndex;
     GridView1.DataSource = ds;
     GridView1.DataBind();
 }
Example #15
0
 protected void GridView1_Sorting(object sender, GridViewSortEventArgs e)
 {
     coluna = e.SortExpression;
     GridView1.DataSource = bindGrid();
     GridView1.DataBind();
 }
Example #16
0
        protected void refresh_databind(object sender, SqlDataSourceStatusEventArgs e)
        {
            GridView1.DataBind();

        }
Example #17
0
 ////////////////////////////////////////////////////
 protected void GridView1_RowCancelingEdit1(object sender, GridViewCancelEditEventArgs e)
 {
     GridView1.EditIndex  = -1;//không lấy giá trị cột nào hết
     GridView1.DataSource = kn.laydata("SELECT * FROM Admin");
     GridView1.DataBind();
 }
Example #18
0
        private void BindGridView()
        {
            cPerson_manage oPerson_manage        = new cPerson_manage();
            DataSet        ds                    = new DataSet();
            string         strMessage            = string.Empty;
            string         strCriteria           = string.Empty;
            string         strperson_manage_code = string.Empty;
            string         strperson_manage_name = string.Empty;
            string         strScript             = string.Empty;

            strperson_manage_code = txtperson_manage_code.Text.Replace("'", "''").Trim();
            strperson_manage_name = txtperson_manage_name.Text.Replace("'", "''").Trim();
            if (!strperson_manage_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_manage_code like '%" + strperson_manage_code + "%') ";
            }
            if (!strperson_manage_name.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_manage_name like '%" + strperson_manage_name + "%')";
            }
            strCriteria = strCriteria + "  And  (c_active ='Y') ";
            try
            {
                if (oPerson_manage.SP_PERSON_MANAGE_SEL(strCriteria, ref ds, ref strMessage))
                {
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        strperson_manage_code = ds.Tables[0].Rows[0]["person_manage_code"].ToString();
                        strperson_manage_name = ds.Tables[0].Rows[0]["person_manage_name"].ToString();
                        if (!ViewState["show"].ToString().Equals("1"))
                        {
                            strScript = "window.parent.frames['iframeShow" + (int.Parse(ViewState["show"].ToString()) - 1) + "'].document.getElementById('" + ViewState["ctrl1"].ToString() + "').value='" + strperson_manage_code + "';\n " +
                                        "window.parent.frames['iframeShow" + (int.Parse(ViewState["show"].ToString()) - 1) + "'].document.getElementById('" + ViewState["ctrl2"].ToString() + "').value='" + strperson_manage_name + "';\n" +
                                        "ClosePopUp('" + ViewState["show"].ToString() + "');";
                        }
                        else
                        {
                            strScript = "window.parent.document.getElementById('" + ViewState["ctrl1"].ToString() + "').value='" + strperson_manage_code + "';\n " +
                                        "window.parent.document.getElementById('" + ViewState["ctrl2"].ToString() + "').value='" + strperson_manage_name + "';\n" +
                                        "ClosePopUp('" + ViewState["show"].ToString() + "');";
                        }
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "close", strScript, true);
                    }
                    else
                    {
                        ds.Tables[0].DefaultView.Sort = ViewState["sort"] + " " + ViewState["direction"];
                        GridView1.DataSource          = ds.Tables[0];
                        GridView1.DataBind();
                    }
                }
                else
                {
                    lblError.Text = strMessage;
                }
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message.ToString();
            }
            finally
            {
                oPerson_manage.Dispose();
                ds.Dispose();
            }
        }
Example #19
0
 protected void gridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     CargarGrid();
     GridView1.PageIndex = e.NewPageIndex;
     GridView1.DataBind();
 }
Example #20
0
 protected void Page_Load(object sender, EventArgs e)
 {
     // if (!IsPostBack)
     GridView1.DataSource = new stagiaireTableAdapter().GetData().ToList();
     GridView1.DataBind();
 }
Example #21
0
 protected void BT1_Click(object sender, EventArgs e)
 {
     SqlDataSource1.SelectCommand = "select * from INS_COMMAND";
     GridView1.DataBind();
 }
Example #22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int mac_found = 0;
                ManagementObjectSearcher   query           = null;
                ManagementObjectCollection queryCollection = null;
                lblMessage.Visible = false;

                try
                {
                    query           = new ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapterConfiguration");
                    queryCollection = query.Get();
                    foreach (ManagementObject mo in queryCollection)
                    {
                        if (mo["MacAddress"] != null)
                        {
                            mac_found = 1;

                            DataTable dtCell           = new DataTable();
                            DataTable dtDataProduction = new DataTable();

                            dtCell = dtStation.GetCellbyMAC(mo["MacAddress"].ToString().Trim());

                            if (dtCell.Rows.Count >= 1)
                            {
                                lblCellID.Text = dtCell.Rows[0]["cell_id"].ToString();
                                string   _data = Request.QueryString["id"];
                                string[] data  = _data.Split(',');
                                lblCellID.Text = data[1].ToString();

                                dtDataProduction = dtProduction.GetProductionByDateByShift(dtCell.Rows[0]["cell_id"].ToString(), "2019/08/28", data[0].ToString());
                                if (dtDataProduction.Rows.Count > 1)
                                {
                                    //textfdkj
                                    //sfsdf
                                    ////dferferf
                                    GridView1.DataSource = dtDataProduction;
                                    GridView1.DataBind();
                                    Session["DataProduction"] = dtDataProduction;


                                    lblProductionDate.Text = "2019/08/28";
                                    lblShift.Text          = data[0].ToString();
                                    txtEmployeeId.Text     = dtDataProduction.Rows[0]["employee"].ToString();
                                    lblLine.Text           = dtDataProduction.Rows[0]["cell_id"].ToString().Substring(0, 1);
                                    lblShift.Text          = dtDataProduction.Rows[0]["shift"].ToString().Substring(0, 1);
                                    lblTotalGood.Text      = dtDataProduction.AsEnumerable().Sum(x => x.Field <int>("good_parts")).ToString();
                                }
                            }
                            else
                            {
                                lblCellID.Text = "Not autorized to open this webpage";
                            }
                        }
                    }

                    if (mac_found == 0)
                    {
                    }
                }
                catch (Exception ex)
                {
                    lblMessage.Text = ex.Message;
                }
            }
        }
Example #23
0
 private void GridViewbind()
 {
     GridView1.DataSource = BLL.CJDLT_LH_SeleteByNum(30);
     GridView1.DataBind();
 }
        private void FillGridView()
        {
            var qtr                   = Quater;
            var partnerId             = PartnerId;
            var SaleVMList            = new List <SalesViewModel>();
            var PlanPerformanceVMList = new List <PlanPerformanceViewModel>();

            var products = _db.Products.OrderBy(p => p.SortOrder);

            foreach (var product in products)
            {
                var sales = _db.Sales.FirstOrDefault(t => t.PartnerId == partnerId && t.QuarterYear == qtr && t.ProductId == product.ProductId);

                if (sales == null)
                {
                    sales = new Data.Models.Sale();
                }

                var currentYear = Quater.Split(' ')[1];

                var previousYear = (Convert.ToInt32(currentYear) - 1).ToString();

                var currentYearData = _db.Sales.Where(t => t.PartnerId == partnerId && t.ProductId == product.ProductId && t.QuarterYear.Contains(currentYear)).ToList();

                var previousYearData = _db.Sales.Where(t => t.PartnerId == partnerId && t.ProductId == product.ProductId && t.QuarterYear.Contains(previousYear)).ToList();

                var SaleVM = new SalesViewModel
                {
                    SaleId             = sales.SaleId,
                    M1                 = sales.M1,
                    M2                 = sales.M2,
                    M3                 = sales.M3,
                    PartnerId          = sales.PartnerId,
                    ProductCategory    = product.ProductCategory,
                    ProductDescription = product.ProductDescription,
                    ProductId          = product.ProductId,
                    QuarterYear        = sales.QuarterYear
                };


                var     cquater1      = currentYearData.FirstOrDefault(t => t.QuarterYear == ("Q1 " + currentYear));
                decimal cquater1Sales = 0;
                if (cquater1 != null)
                {
                    cquater1Sales = cquater1.M1 + cquater1.M2 + cquater1.M3;
                }
                var cquater2 = currentYearData.FirstOrDefault(t => t.QuarterYear == ("Q2 " + currentYear));

                decimal cquater2Sales = 0;
                if (cquater2 != null)
                {
                    cquater2Sales = cquater2.M1 + cquater2.M2 + cquater2.M3;
                }
                var cquater3 = currentYearData.FirstOrDefault(t => t.QuarterYear == ("Q3 " + currentYear));

                decimal cquater3Sales = 0;
                if (cquater3 != null)
                {
                    cquater3Sales = cquater3.M1 + cquater3.M2 + cquater3.M3;
                }
                var cquater4 = currentYearData.FirstOrDefault(t => t.QuarterYear == ("Q4 " + currentYear));

                decimal cquater4Sales = 0;
                if (cquater4 != null)
                {
                    cquater4Sales = cquater4.M1 + cquater4.M2 + cquater4.M3;
                }

                var     pquater1      = previousYearData.FirstOrDefault(t => t.QuarterYear == ("Q1 " + previousYear));
                decimal pquater1Sales = 0;
                if (pquater1 != null)
                {
                    pquater1Sales = pquater1.M1 + pquater1.M2 + pquater1.M3;
                }

                var     pquater2      = previousYearData.FirstOrDefault(t => t.QuarterYear == ("Q2 " + previousYear));
                decimal pquater2Sales = 0;
                if (pquater2 != null)
                {
                    pquater2Sales = pquater2.M1 + pquater2.M2 + pquater2.M3;
                }

                var     pquater3      = previousYearData.FirstOrDefault(t => t.QuarterYear == ("Q3 " + previousYear));
                decimal pquater3Sales = 0;
                if (pquater3 != null)
                {
                    pquater3Sales = pquater3.M1 + pquater3.M2 + pquater3.M3;
                }

                var     pquater4      = previousYearData.FirstOrDefault(t => t.QuarterYear == ("Q4 " + previousYear));
                decimal pquater4Sales = 0;
                if (pquater4 != null)
                {
                    pquater4Sales = pquater4.M1 + pquater4.M2 + pquater4.M3;
                }

                var PerformanceVM = new PlanPerformanceViewModel
                {
                    SaleId             = sales.SaleId,
                    M1                 = sales.M1,
                    M2                 = sales.M2,
                    M3                 = sales.M3,
                    PartnerId          = sales.PartnerId,
                    ProductCategory    = product.ProductCategory,
                    ProductDescription = product.ProductDescription,
                    ProductId          = product.ProductId,
                    CQ1                = cquater1Sales,
                    CQ2                = cquater2Sales,
                    CQ3                = cquater3Sales,
                    CQ4                = cquater4Sales,
                    PQ1                = pquater1Sales,
                    PQ2                = pquater2Sales,
                    PQ3                = pquater3Sales,
                    PQ4                = pquater4Sales
                };


                var prevQtr      = Utility.QuarterHelper.GetPrevQuarter(Quater);
                var prevQtrSales = _db.Sales.Where(t => t.PartnerId == PartnerId && t.ProductId == product.ProductId && t.QuarterYear == prevQtr.QuarterYear).ToList();
                if (prevQtrSales.Any())
                {
                    SaleVM.PrevQtr        = prevQtrSales.Sum(t => t.M1 + t.M2 + t.M3);
                    PerformanceVM.PrevQtr = prevQtrSales.Sum(t => t.M1 + t.M2 + t.M3);
                }

                SaleVMList.Add(SaleVM);

                PlanPerformanceVMList.Add(PerformanceVM);
            }
            GridView1.DataSource = PlanPerformanceVMList;
            GridView1.DataBind();
            GridView1.UseAccessibleHeader    = true;
            GridView1.HeaderRow.TableSection = TableRowSection.TableHeader;
        }
Example #25
0
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            string Schoolid = Session["SchoolId"].ToString();


            string directoryPath = Server.MapPath(string.Format("~/ExcelFile/{0}/", Schoolid.Trim()));

            if (!Directory.Exists(directoryPath))
            {
                Directory.CreateDirectory(directoryPath);
            }

            //Get path from web.config file to upload
            string FilePath = string.Format("~/ExcelFile/{0}/", Schoolid.Trim());//ConfigurationManager.AppSettings["FilePath"].ToString();
            string filename = string.Empty;

            //To check whether file is selected or not to uplaod
            if (FileUploadToServer.HasFile)
            {
                try
                {
                    string[] allowdFile = { ".xls" };//, ".xlsx" };
                    //Here we are allowing only excel file so verifying selected file pdf or not
                    string FileExt = System.IO.Path.GetExtension(FileUploadToServer.PostedFile.FileName);
                    //Check whether selected file is valid extension or not
                    bool isValidFile = allowdFile.Contains(FileExt);
                    if (!isValidFile)
                    {
                        divsucrss.Style.Add("display", "none");
                        divUnsucrss.Style.Remove("display");
                        ltrNotSucess.Text = "Please upload only Excel";
                    }
                    else
                    {
                        // Get size of uploaded file, here restricting size of file
                        int FileSize = FileUploadToServer.PostedFile.ContentLength;
                        if (FileSize <= 3048576)//1048576 byte = 1MB
                        {
                            //Get file name of selected file
                            filename = Path.GetFileName(Server.MapPath(FileUploadToServer.FileName));

                            //Save selected file into server location
                            FileUploadToServer.SaveAs(Server.MapPath(FilePath) + filename);
                            //Get file path
                            string filePath = Server.MapPath(FilePath) + filename;
                            //Open the connection with excel file based on excel version
                            OleDbConnection con = null;
                            if (FileExt == ".xls")
                            {
                                con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filePath + ";Extended Properties=Excel 8.0;");
                            }
                            else if (FileExt == ".xlsx")
                            {
                                // con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filePath + ";Extended Properties=Excel 12.0;");
                            }
                            con.Open();
                            //Get the list of sheet available in excel sheet
                            DataTable dt = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
                            //Get first sheet name
                            string getExcelSheetName = dt.Rows[0]["Table_Name"].ToString();
                            //Select rows from first sheet in excel sheet and fill into dataset
                            OleDbCommand     ExcelCommand = new OleDbCommand(@"SELECT * FROM [" + getExcelSheetName + @"]", con);
                            OleDbDataAdapter ExcelAdapter = new OleDbDataAdapter(ExcelCommand);
                            DataSet          ExcelDataSet = new DataSet();
                            ExcelAdapter.Fill(ExcelDataSet);
                            con.Close();
                            // var aa=ExcelDataSet.Tables[0].Rows.
                            try
                            {
                                string Filds   = clsStdDetail.GetSchoolFild(Schoolid).Select(x => x.MyIdFild).FirstOrDefault().ToString();
                                var    lstFild = Filds;

                                //if (lstFild.Contains("[StudentPhoto]"))
                                //    dtxtStudentPhoto.Style.Remove("display");
                                //if (lstFild.Contains("[Status]"))
                                //    dtxtStatus.Style.Remove("display");


                                for (int i = 0; i < ExcelDataSet.Tables[0].Rows.Count; i++)
                                {
                                    objStd.SchoolUID = Schoolid;

                                    if (lstFild.Contains("[ScholarNo]"))
                                    {
                                        objStd.ScholarNo = ExcelDataSet.Tables[0].Rows[i]["ScholarNo"].ToString();
                                    }
                                    else
                                    {
                                        objStd.ScholarNo = "";
                                    }
                                    if (lstFild.Contains("[StudentName]"))
                                    {
                                        objStd.StudentName = ExcelDataSet.Tables[0].Rows[i]["StudentName"].ToString();
                                    }
                                    else
                                    {
                                        objStd.StudentName = "";
                                    }

                                    if (lstFild.Contains("[FatherName]"))
                                    {
                                        objStd.FatherName = ExcelDataSet.Tables[0].Rows[i]["FatherName"].ToString();
                                    }
                                    else
                                    {
                                        objStd.FatherName = "";
                                    }
                                    if (lstFild.Contains("[MotherName]"))
                                    {
                                        objStd.MotherName = ExcelDataSet.Tables[0].Rows[i]["MotherName"].ToString();
                                    }
                                    else
                                    {
                                        objStd.MotherName = "";
                                    }
                                    if (lstFild.Contains("[BloodGroup]"))
                                    {
                                        objStd.BloodGroup = ExcelDataSet.Tables[0].Rows[i]["BloodGroup"].ToString();
                                    }
                                    else
                                    {
                                        objStd.BloodGroup = "";
                                    }
                                    if (lstFild.Contains("[PhoneNumber]"))
                                    {
                                        objStd.PhoneNumber = ExcelDataSet.Tables[0].Rows[i]["PhoneNumber"].ToString();
                                    }
                                    else
                                    {
                                        objStd.PhoneNumber = "";
                                    }
                                    if (lstFild.Contains("[DateofBarth]"))
                                    {
                                        try {
                                            objStd.DateofBarth = Convert.ToDateTime(ExcelDataSet.Tables[0].Rows[i]["DateofBirth"]).ToString("dd/MM/yyyy");
                                        }
                                        catch { objStd.DateofBarth          = "";
                                                ltrupdaterecorddetail.Text += " <spain style='color:red'>" + ExcelDataSet.Tables[0].Rows[i]["ScholarNo"].ToString() + "</spain>"; }
                                    }
                                    else
                                    {
                                        objStd.DateofBarth = "";
                                    }
                                    if (lstFild.Contains("[Class]"))
                                    {
                                        objStd.Class = ExcelDataSet.Tables[0].Rows[i]["Class"].ToString();
                                    }
                                    else
                                    {
                                        objStd.Class = "";
                                    }
                                    if (lstFild.Contains("[EmailId]"))
                                    {
                                        objStd.EmailId = ExcelDataSet.Tables[0].Rows[i]["EmailId"].ToString();
                                    }
                                    else
                                    {
                                        objStd.EmailId = "";
                                    }
                                    if (lstFild.Contains("[Addres]"))
                                    {
                                        objStd.Addres = ExcelDataSet.Tables[0].Rows[i]["ADDRESS"].ToString();
                                    }
                                    else
                                    {
                                        objStd.Addres = "";
                                    }
                                    if (lstFild.Contains("[F2]"))
                                    {
                                        objStd.F2 = ExcelDataSet.Tables[0].Rows[i]["OTHER1"].ToString();
                                    }
                                    else
                                    {
                                        objStd.F2 = "";
                                    }
                                    if (lstFild.Contains("[F3]"))
                                    {
                                        objStd.F3 = ExcelDataSet.Tables[0].Rows[i]["OTHER2"].ToString();
                                    }
                                    else
                                    {
                                        objStd.F3 = "";
                                    }
                                    if (lstFild.Contains("[F4]"))
                                    {
                                        objStd.F4 = ExcelDataSet.Tables[0].Rows[i]["OTHER3"].ToString();
                                    }
                                    else
                                    {
                                        objStd.F4 = "";
                                    }
                                    if (lstFild.Contains("[StudentPhoto]"))
                                    {
                                        string pto = ExcelDataSet.Tables[0].Rows[i]["StudentPhoto"].ToString();

                                        objStd.StudentPhoto = "StdPhoto/" + Schoolid + "/" + (pto.Contains(".") ?  pto : pto + ".jpg");
                                    }
                                    else
                                    {
                                        objStd.StudentPhoto = "";
                                    }

                                    objStd.F1          = ExcelDataSet.Tables[0].Rows[i]["TITLE"].ToString();
                                    objStd.LastUpdated = DateTime.Now;
                                    objStd.IsActive    = 1;
                                    objStd.Status      = 0;
                                    //objStd.StudentPhoto= //img
                                    int isExist = clsStdDetail.GetStudentDetail(Schoolid, objStd.ScholarNo).Count;
                                    if (isExist > 0)
                                    {
                                        objStd.ScholarNo_Old = ExcelDataSet.Tables[0].Rows[i]["ScholarNo"].ToString();

                                        string retCode = clsStdDetail.UpdateStudetDetail(objStd);
                                        if (retCode != "1")
                                        {
                                            divsucrss.Style.Add("display", "none");
                                            divUnsucrss.Style.Remove("display");
                                            ltrNotSucess.Text = retCode + "There are some error contact to admin !!";
                                        }
                                        else
                                        {
                                            divUnsucrss.Style.Add("display", "none");
                                            divsucrss.Style.Remove("display");
                                            ltrSucess.Text = "Data Inserted Sucess  ";

                                            divupdatedrecord.Style.Remove("display");
                                            ltrupdaterecorddetail.Text += objStd.ScholarNo_Old + "   ";
                                        }
                                    }
                                    else
                                    {
                                        string retCode = clsStdDetail.InsertStudetDetail(objStd);
                                        if (retCode != "1")
                                        {
                                            divsucrss.Style.Add("display", "none");
                                            divUnsucrss.Style.Remove("display");
                                            ltrNotSucess.Text = retCode + "There are some error contact to admin !!";
                                        }
                                        else
                                        {
                                            divUnsucrss.Style.Add("display", "none");
                                            divsucrss.Style.Remove("display");
                                            ltrSucess.Text = "Data Inserted Sucess  ";
                                        }
                                    }
                                }
                                GridView1.DataSource = ExcelDataSet;
                                GridView1.DataBind();
                            }
                            catch (Exception s)
                            {
                                divsucrss.Style.Add("display", "none");
                                divUnsucrss.Style.Remove("display");
                                ltrNotSucess.Text = s.Message + "There are some error contact to admin !!";
                            }
                        }
                        else
                        {
                            divsucrss.Style.Add("display", "none");
                            divUnsucrss.Style.Remove("display");
                            ltrNotSucess.Text = "Attachment file size should not be greater then 1 MB !";
                        }
                    }
                }
                catch (Exception ex)
                {
                    divsucrss.Style.Add("display", "none");
                    divUnsucrss.Style.Remove("display");
                    ltrNotSucess.Text = "Error occurred while uploading a file: " + ex.Message;
                }
            }
            else
            {
                divsucrss.Style.Add("display", "none");
                divUnsucrss.Style.Remove("display");
                ltrNotSucess.Text = "Please select a file to upload.";
            }
        }
 protected void Button1_Click(object sender, EventArgs e)
 {
     db.assignEmployeeHall(LabelEmployeeId.Text, DropDownListHall.SelectedItem.Text);
     GridView1.DataBind();// UpdateRow(GridView1.SelectedIndex, false);
 }
Example #27
0
        /// <summary>
        /// 绑定数据
        /// </summary>
        public void bind()
        {
            if (!Common.Validate.IsDateTime(tboxTimeB.Text) || !Common.Validate.IsDateTime(tboxTimeE.Text))
            {
                Common.MsgBox.Show(this, App_GlobalResources.Language.Tip_TimeError);
                return;
            }
            //if (Convert.ToDateTime(tboxTimeB.Text) > DateTime.Now.AddDays(-1))
            //{
            //    tboxTimeB.Text = DateTime.Now.AddDays(-1).ToString(SmallDateTimeFormat)  ;
            //}

            //设置日期按钮状态
            string   dates = Convert.ToDateTime(tboxTimeB.Text).ToString("yyyy-MM-01");
            DateTime dtb   = Convert.ToDateTime(dates);
            DateTime dte   = dtb.AddMonths(1).AddDays(-1);

            for (int i = 0; i <= 32; i++)
            {
                Control ctl = DateSelect.FindControl("btndateselect" + i);
                if (ctl != null && ctl.GetType() == typeof(Button))
                {
                    Button btn = (Button)ctl;
                    if (dtb.AddDays(i - 1) <= DateTime.Now && (i <= dte.Day || i == 32))
                    {
                        btn.Visible = true;
                        if (btn.Text == Convert.ToDateTime(tboxTimeB.Text).ToString("dd"))
                        {
                            btn.CssClass = "buttonblueo";
                            btn.Enabled  = false;
                        }
                        else
                        {
                            btn.CssClass = "buttonblue";
                            btn.Enabled  = true;
                        }
                    }
                    else
                    {
                        btn.Visible = false;
                    }
                }
            }
            LabelArea.Text = DropDownListArea1.SelectedItem.Text;
            if (DropDownListArea2.SelectedIndex > 0)
            {
                LabelArea.Text += "|" + DropDownListArea2.SelectedItem.Text;
            }



            DateTime searchdateB = DateTime.Now.AddDays(-1);
            DateTime searchdateE = DateTime.Now;



            if (tboxTimeB.Text.Length > 0)
            {
                searchdateB = Convert.ToDateTime(tboxTimeB.Text);
            }
            if (tboxTimeE.Text.Length > 0)
            {
                searchdateE = Convert.ToDateTime(tboxTimeE.Text);
            }
            LabelTime.Text = searchdateB.ToString(SmallDateTimeFormat) + " ";

            string sqlwhere = " where 1=1 ";

            if (tboxUID.Text.Trim().Length > 0)
            {
                sqlwhere += @" and UID =" + tboxUID.Text.Replace("'", "") + "";
            }
            if (tboxCID.Text.Trim().Length > 0)
            {
                sqlwhere += @" and CID =" + tboxCID.Text.Replace("'", "") + "";
            }
            if (tboxPARA_1.Text.Trim().Length > 0)
            {
                sqlwhere += @" and PARA_1 =" + tboxPARA_1.Text.Replace("'", "") + "";
            }

            if (DropDownListCType.SelectedIndex > 0)
            {
                sqlwhere += @" and OPID = " + DropDownListCType.SelectedValue + "";
            }
            else if (tboxOPID.Text.Length > 0)
            {
                sqlwhere += @" and OPID = " + tboxOPID.Text.Replace("'", "") + "";
            }



            try
            {
                string bigzoneid = DropDownListArea1.SelectedValue.Split(',')[1];
                string zoneid    = DropDownListArea2.SelectedValue.Split(',')[1];
                int    pcount    = 0;

                SqlParameter[] parameters =
                {
                    new SqlParameter("@BigZoneID",  SqlDbType.Int),
                    new SqlParameter("@ZoneID",     SqlDbType.Int),
                    new SqlParameter("@DBType",     SqlDbType.Int),
                    new SqlParameter("@QueryTable", SqlDbType.NVarChar,   50),
                    new SqlParameter("@QueryDate",  SqlDbType.DateTime),
                    new SqlParameter("@Query",      SqlDbType.NVarChar,  100),
                    new SqlParameter("@PageIndex",  SqlDbType.Int),
                    new SqlParameter("@PageSize",   SqlDbType.Int),
                    new SqlParameter("@PageType",   SqlDbType.Int),
                    new SqlParameter("@PCount",     SqlDbType.Int),
                };
                parameters[0].Value     = bigzoneid;
                parameters[1].Value     = zoneid;
                parameters[2].Value     = 0;
                parameters[3].Value     = "_other_log";
                parameters[4].Value     = searchdateB.ToString(SmallDateTimeFormat);
                parameters[5].Value     = sqlwhere;
                parameters[6].Value     = lblPageIndex.Text;
                parameters[7].Value     = GridView1.PageSize;
                parameters[8].Value     = lblPageType.Text;//0普通分页 1连续ID分页
                parameters[9].Direction = ParameterDirection.Output;


                ds = DBHelperDigGameDB.RunProcedure("_Query_GSLOGDB", parameters, "ds", 180);
                DataView myView = ds.Tables[0].DefaultView;
                pcount = (int)parameters[9].Value;

                if (myView.Count == 0)
                {
                    lblerro.Visible = true;
                    myView.AddNew();

                    lblCount.Text     = pcount.ToString();
                    lblPageCount.Text = (pcount % GridView1.PageSize == 0 ? pcount / GridView1.PageSize : pcount / GridView1.PageSize + 1).ToString();
                }
                else
                {
                    lblerro.Visible   = false;
                    lblPageCount.Text = (pcount % GridView1.PageSize == 0 ? pcount / GridView1.PageSize : pcount / GridView1.PageSize + 1).ToString();
                    lblCount.Text     = pcount.ToString();

                    lbtnF.Enabled = true;
                    lbtnP.Enabled = true;
                    lbtnN.Enabled = true;
                    lbtnE.Enabled = true;
                    if (lblPageIndex.Text == "1")
                    {
                        lbtnF.Enabled = false;
                        lbtnP.Enabled = false;
                    }
                    else if (lblPageIndex.Text == lblPageCount.Text)
                    {
                        lbtnN.Enabled = false;
                        lbtnE.Enabled = false;
                    }
                    tboxPageIndex.Text = lblPageIndex.Text;
                }

                GridView1.DataSource = myView;
                GridView1.DataBind();
            }
            catch (System.Exception ex)
            {
                GridView1.DataSource = null;
                GridView1.DataBind();
                lblerro.Visible = true;
                lblerro.Text    = App_GlobalResources.Language.LblError + ex.Message;
                lblinfo.Text    = ex.Message;
            }
        }
Example #28
0
 public void bind()
 {
     GridView1.DataSourceID = SqlDataSource1.ID;
     GridView1.DataBind();
 }
Example #29
0
 protected void Page_Load(object sender, EventArgs e)
 {
     GridView1.DataSource = getrecords();
     GridView1.DataBind();
 }
Example #30
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string from = Request.Form["from"];
        string to   = Request.Form["to"];
        bool   flag = true;

        if (from == "")
        {
            ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('From is request.');</script>");
            flag = false;
            GridView1.Visible = false;
            Chartlet1.Visible = false;
        }

        if (to == "")
        {
            ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('To is request.');</script>");
            flag = false;
            GridView1.Visible = false;
            Chartlet1.Visible = false;
        }

        if (flag)
        {
            string SQL_select =
                "select station as Station, SUM(BD.VAL_09),COUNT(BD.VAL_09), Convert(decimal(18,2),SUM(BD.VAL_09)*1.0/COUNT(BD.VAL_09)) Avg"
                + " from BCSS_DATE BD"
                + " where STATUS='NEW'"
                + " and BD.VAL_01<>0"
                + " and (CAST(DEP_DT AS date) between @from and @to)"
                + " group by station"
                + " order by station";
            SqlParameter[] parm = new SqlParameter[] {
                new SqlParameter("@from", SqlDbType.Date),
                new SqlParameter("@to", SqlDbType.Date)
            };
            parm[0].Value = from;
            parm[1].Value = to;
            DataTable  dt  = new DataTable();
            DataColumn dc1 = new DataColumn("Station", Type.GetType("System.String"));
            DataColumn dc2 = new DataColumn("Point", Type.GetType("System.String"));
            //DataColumn dc3 = new DataColumn("Point2", Type.GetType("System.String"));
            dt.Columns.Add(dc1);
            dt.Columns.Add(dc2);
            //dt.Columns.Add(dc3);
            using (SqlDataReader rdr = SqlHelper.ExecuteReader(SqlHelper.Conn1, CommandType.Text, SQL_select, parm))
            {
                while (rdr.Read())
                {
                    DataRow dr = dt.NewRow();
                    dr["Station"] = rdr["Station"].ToString();
                    dr["Point"]   = rdr["Avg"].ToString();
                    // dr["point2"] = rdr["avg2"].ToString();
                    dt.Rows.Add(dr);
                }
            }


            if (dt.Rows.Count > 0)
            {
                DataTable dt1 = new DataTable();
                dt1 = rowtocolumn(dt);
                GridView1.DataSource = dt1;
                GridView1.DataBind();
                GridView1.Visible = true;
                Chartlet1.BindChartData(dt);
                Chartlet1.Visible = true;
                // Chartlet1.MaxValueY = 100;
                // Chartlet1.Shadow.Radius = 3;
                Chartlet1.ChartTitle.Text  = "Avg Satisfaction for Question9";
                Chartlet1.YLabels.UnitText = "point";
            }
            else
            {
                GridView1.Visible = false;
                Chartlet1.Visible = false;
            }
        }
    }