Example #1
0
    protected void ASPxGridView1_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        ASPxTextBox  uCode  = ASPxGridView1.FindEditFormTemplateControl("txtStationCode") as ASPxTextBox;
        ASPxTextBox  uName  = ASPxGridView1.FindEditFormTemplateControl("txtStationName") as ASPxTextBox;
        ASPxComboBox uTcode = ASPxGridView1.FindEditFormTemplateControl("dropStaionType") as ASPxComboBox;
        ASPxComboBox uPcode = ASPxGridView1.FindEditFormTemplateControl("dropPlineCode") as ASPxComboBox;
        ASPxTextBox  uScode = ASPxGridView1.FindEditFormTemplateControl("dropStaionArea") as ASPxTextBox;

        StationEntity s = new StationEntity()
        {
            COMPANY_CODE      = theCompanyCode,
            PLINE_CODE        = uPcode.Value.ToString(),
            STATION_CODE      = uCode.Text.Trim(),
            STATION_NAME      = uName.Text.Trim(),
            STATION_TYPE_CODE = uTcode.Value as string,
            STATION_AREA_CODE = uScode.Value as string,
            WORKUNIT_CODE     = e.NewValues["WORKUNIT_CODE"] as string
        };

        s.RMES_ID = s.STATION_CODE;
        StationFactory.Insert(s);

        //string Sql = "INSERT INTO CODE_STATION (COMPANY_CODE,STATION_CODE,STATION_NAME,STATION_TYPE_CODE,PLINE_CODE,STATION_AREA_CODE) "
        //     + "VALUES('" + theCompanyCode + "','" + uCode.Text.Trim() + "','" + uName.Text.Trim() + "','" + uTcode.Value.ToString() + "','" + uPcode.Value.ToString() + "','" + uScode.Value.ToString() + "')";
        //dc.ExeSql(Sql);

        e.Cancel = true;
        ASPxGridView1.CancelEdit();
        setCondition();
    }