Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ToolkitScriptManager1.RegisterAsyncPostBackControl(bShow);
            tbStart.Attributes.Add("readonly", "readonly");
            tbEnd.Attributes.Add("readonly", "readonly");
            DA = new SqlDataAdapter();
            DS = new DataSet();
            DA.SelectCommand            = new SqlCommand();
            DA.SelectCommand.Connection = new SqlConnection("Data Source=127.0.0.1;Initial Catalog=CWM;Persist Security Info=True;User ID=CWM;Password=manager");

            if (!Page.IsPostBack)
            {
                CalendarExtender1.SelectedDate = DateTime.Today;
                CalendarExtender2.SelectedDate = DateTime.Today;
                tbStart.Text = DateTime.Today.ToString("dd.MM.yyyy");
                tbEnd.Text   = DateTime.Today.ToString("dd.MM.yyyy");
                DA.SelectCommand.CommandText = "select ID,ASNAME from CWM..ADDITIONALSERVICE";
                DS = new DataSet();
                DA.Fill(DS, "ADDSERV");
                chblEmp.DataSource     = DS.Tables["ADDSERV"];
                chblEmp.DataTextField  = "ASNAME";
                chblEmp.DataValueField = "ID";
                chblEmp.DataBind();
                chblEmp.RepeatColumns = 3;
            }
            else
            {
                DateTime tmp;
                //if ((!DateTime.TryParse(tbStart.Text, out tmp)) || (!DateTime.TryParse(tbEnd.Text, out tmp)))
                {
                    CalendarExtender1.SelectedDate = DateTime.ParseExact(tbStart.Text, CalendarExtender1.Format, null);
                    CalendarExtender2.SelectedDate = DateTime.ParseExact(tbEnd.Text, CalendarExtender2.Format, null);
                }
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bAdd.Attributes.Add("onclick", " this.disabled = true; " + ClientScript.GetPostBackEventReference(bAdd, null) + ";");
            tbCar.Attributes["onclick"] = "chbManual.Checeked = !chbManual.Checeked";
            ToolkitScriptManager1.RegisterAsyncPostBackControl(bAdd);
            DA = new SqlDataAdapter();
            DS = new DataSet();
            DA.SelectCommand            = new SqlCommand();
            DA.SelectCommand.Connection = new SqlConnection("Data Source=127.0.0.1;Initial Catalog=CWM;Persist Security Info=True;User ID=CWM;Password=manager");
            if (!Page.IsPostBack)
            {
                DA.SelectCommand.CommandText = "select ID,LNAME from CWM..LINE";
                DA.Fill(DS, "L");
                ddlLine.DataSource     = DS.Tables["L"];
                ddlLine.DataTextField  = "LNAME";
                ddlLine.DataValueField = "ID";
                ddlLine.DataBind();

                DA.SelectCommand.CommandText = "select ID,ENAME from CWM..EMPLOYEE where (DELETED != 1 or DELETED is null) order by ENAME";
                DA.Fill(DS, "E");
                DataView dve = new DataView();
                dve      = DS.Tables["E"].DefaultView;
                dve.Sort = "ENAME";

                ddlCar.DataSource           = dve;
                ddlEmployees.DataSource     = dve;
                ddlEmployees.DataTextField  = "ENAME";
                ddlEmployees.DataValueField = "ID";
                ddlEmployees.DataBind();
                DA.SelectCommand.CommandText = "select ID,CNAME+': '+ANNOTATION as CNAME from CWM..CARCLASS";
                DS = new DataSet();
                DA.Fill(DS, "C");
                ddlClass.DataSource     = DS.Tables["C"];
                ddlClass.DataTextField  = "CNAME";
                ddlClass.DataValueField = "ID";
                ddlClass.DataBind();
                DA.SelectCommand.CommandText = "select ID,CNAME from CWM..CAR where IDCLASS = " + ddlClass.SelectedValue + "  order by CNAME";
                DS = new DataSet();
                DA.Fill(DS, "CAR");
                DataView dv = new DataView();
                dv      = DS.Tables["CAR"].DefaultView;
                dv.Sort = "CNAME";

                ddlCar.DataSource     = dv;
                ddlCar.DataTextField  = "CNAME";
                ddlCar.DataValueField = "ID";

                ddlCar.DataBind();

                /*DA.SelectCommand.CommandText = "select ID,PNAME from CWM..PRICELIST where IDCLASS = " + ddlClass.SelectedValue
                 + " order by PNAME";
                 + DS = new DataSet();
                 + DA.Fill(DS, "PRICE");
                 + chblPrice.DataSource = DS.Tables["PRICE"];
                 + chblPrice.DataTextField = "PNAME";
                 + chblPrice.DataValueField = "ID";
                 + chblPrice.DataBind();
                 + chblPrice.RepeatColumns = 2;*/

                /*DA.SelectCommand.CommandText = "select ID,ASNAME from CWM..ADDITIONALSERVICE order by ASNAME";
                 * DS = new DataSet();
                 * DA.Fill(DS, "ADDITIONALSERVICE");
                 * chblAddServ.DataSource = DS.Tables["ADDITIONALSERVICE"];
                 * chblAddServ.DataTextField = "ASNAME";
                 * chblAddServ.DataValueField = "ID";
                 * chblAddServ.DataBind();
                 * chblAddServ.RepeatColumns = 2;*/
            }
        }