Dispose() 보호된 메소드

protected Dispose ( bool disposing ) : void
disposing bool
리턴 void
예제 #1
0
 public string GetfeederActivationCode(string fid)
 {
     CheckHasRows();
     DataView dv = new DataView(dtfeeder);
     dv.RowFilter = "feederNumber = " + fid;
     string returnval = "";
     if (dv.Count > 0)
     {
         returnval = dv[0]["FeederActivationCode"].ToString();
     }
     dv.Dispose();
     return returnval;
 }
예제 #2
0
 public double GetfeederPosX(string fid)
 {
     CheckHasRows();
     DataView dv = new DataView(dtfeeder);
     dv.RowFilter = "feederNumber = " + fid;
     double returnval = 0.0;
     if (dv.Count > 0)
     {
         returnval = double.Parse(dv[0]["PosX"].ToString());
     }
     dv.Dispose();
     return returnval;
 }
예제 #3
0
 public void addData(int iAddCnt, int iScrollingRowIndex, DataView dv)
 {
     try
     {
         int iRowCnt = base.dgvLogData.Rows.Count + iAddCnt;
         int count = base.m_dvLogData.Count;
         int num3 = 0;
         if (iAddCnt >= base.iMaxLogCnt)
         {
             base.m_dtLogData.Rows.Clear();
             num3 = iAddCnt - base.iMaxLogCnt;
         }
         else if (iRowCnt > base.iMaxLogCnt)
         {
             for (int i = 1; i <= (iRowCnt - base.iMaxLogCnt); i++)
             {
                 base.m_dvLogData.Delete((int) (count - i));
             }
         }
         base.m_dvLogData.Sort = "";
         DataRow row = null;
         int num5 = 0;
         while (num3 < iAddCnt)
         {
             row = dv[num3].Row;
             num5 = base.dgvLogData.SelectedRows.Count;
             base.m_dtLogData.ImportRow(row);
             num3++;
         }
         base.SetCurrentRow(base.dgvLogData, iRowCnt, base.iMaxLogCnt, iAddCnt);
         num5 = base.dgvLogData.SelectedRows.Count;
         row = null;
         base.m_dvLogData.Sort = "ReceTime DESC";
         if (num5 == 0)
         {
             base.dgvLogData.ClearSelection();
         }
         if (iScrollingRowIndex >= 0)
         {
             base.dgvLogData.FirstDisplayedScrollingRowIndex = iScrollingRowIndex;
         }
         base.dgvLogData.Refresh();
         dv.Dispose();
         dv = null;
     }
     catch
     {
     }
 }
예제 #4
0
 public double GetComponentsHeight(string fid)
 {
     if (dscomponents.Tables.Count == 0)
     {
         POPComponentsTable();
     }
     DataView dv = new DataView(dscomponents.Tables[0]);
     dv.RowFilter = "ComponentCode = " + fid;
     double returnval = 0.0;
     if (dv.Count > 0)
     {
         returnval = double.Parse(dv[0]["ComponentHeight"].ToString());
     }
     dv.Dispose();
     return returnval;
 }
예제 #5
0
 public string GetComponentPackage(string fid)
 {
     if (dscomponents.Tables.Count == 0)
     {
         POPComponentsTable();
     }
     DataView dv = new DataView(dscomponents.Tables[0]);
     dv.RowFilter = "ComponentCode = " + fid;
     string returnval = "";
     if (dv.Count > 0)
     {
         returnval = dv[0]["Package"].ToString();
     }
     dv.Dispose();
     return returnval;
 }
 public double GetfeederPosX(string fid)
 {
     if (ds.Tables.Count == 0)
     {
         POPFeedersTable();
     }
     DataView dv = new DataView(ds.Tables[0]);
     dv.RowFilter = "feederNumber = " + fid;
     double returnval = 0.0;
     if (dv.Count > 0)
     {
         returnval = double.Parse(dv[0][2].ToString());
     }
     dv.Dispose();
     return returnval;
 }
 public string GetfeederNumber(string fid)
 {
     if (ds.Tables.Count == 0)
     {
         POPFeedersTable();
     }
     DataView dv = new DataView(ds.Tables[0]);
     dv.RowFilter = "feederNumber = " + fid;
     string returnval = "";
     if (dv.Count > 0)
     {
         returnval = dv[0][0].ToString();
     }
     dv.Dispose();
     return returnval;
 }
예제 #8
0
 public bool GetFeederPickPlusChipHeight(string fid)
 {
     CheckHasRows();
     DataView dv = new DataView(dtfeeder);
     dv.RowFilter = "feederNumber = " + fid;
     bool returnval = false;
     if (dv.Count > 0)
     {
         if (dv[0]["PickPlusChipHeight"].ToString().Equals("True"))
         {
             returnval = true;
         }
         else
         {
             returnval = false;
         }
     }
     dv.Dispose();
     return returnval;
 }
    private string FootprintCatGetRows(System.Data.DataView dv, string strFilter, int intCurrentPage, string strPageName)
    {
        try
        {
            if (strFilter.Length > 0)
            {
                StringBuilder CatMenusb = new StringBuilder();
                dv.RowFilter = "FCPkey = " + strFilter + "";

                foreach (System.Data.DataRowView drv in dv)
                {
                    if (intCurrentPage == 1)
                    {
                        CatMenusb.Insert(0, " > " + drv["FCName"].ToString() + "");
                        intCurrentPage = 0;
                        CatMenusb.Insert(0, FootprintCatGetRows(dv, drv["ParentCategory"].ToString(), intCurrentPage, strPageName));
                    }
                    else
                    {
                        CatMenusb.Insert(0, " > " + drv["FCName"].ToString() + "");
                        CatMenusb.Insert(0, FootprintCatGetRows(dv, drv["ParentCategory"].ToString(), intCurrentPage, strPageName));
                    }
                }
                dv.Dispose();
                return(CatMenusb.ToString());
            }
            else
            {
                return("");
            }
        }
        catch
        {
            return("error with CatGetRows function");
        }
    }
예제 #10
0
        public void ObtenerPorProceso(Procesos proceso)
        {
            Conexion datos = new Conexion(Empresa);
            DataSet dataSet = new DataSet();
            DataView dataView = new DataView();
            DataTable dataTable = new DataTable();
            String sql = null;

            sql = "usp_oper_permisos_obtenerPorProceso ";
            sql += "'" + proceso.ToString() + "'";

            try
            {
                dataSet = datos.ExecuteReader(sql);
                dataView = dataSet.Tables[0].DefaultView;
                dataTable = dataView.Table;
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            finally
            {
                Cargar(dataTable, proceso.ToString());
                if (dataTable != null) dataTable.Dispose();
                if (dataView != null) dataView.Dispose();
                if (dataSet != null) dataSet.Dispose();
                datos.Desconectar();
            }
        }
예제 #11
0
    private void Bind()
    {
        int ChType = 1;
        B_Dictionary dictionBll = new B_Dictionary();
        DataTable chTypeDt = dictionBll.GetDictionary(ChType);

        for (int i = 0; i < chTypeDt.Rows.Count; i++)
        {
            TreeNode chTypeNode = new TreeNode();
            chTypeNode.ToolTip = "分类右键操作$" + chTypeDt.Rows[i]["id"].ToString();
            chTypeNode.Text = chTypeDt.Rows[i]["DicName"].ToString();
            chTypeNode.ImageUrl = "~/system/images/category.gif";
            chTypeNode.NavigateUrl = "~/system/info/ChannelList.aspx?ChType=" + chTypeDt.Rows[i]["id"].ToString();
            chTypeNode.Target = "ContentIframe";
            tvNav.Nodes.Add(chTypeNode);
        }
        TreeNode chTypeOtherNode = new TreeNode();
        chTypeOtherNode.ToolTip = "分类右键操作$0";
        chTypeOtherNode.Text = "其他";
        chTypeOtherNode.ImageUrl = "~/system/images/category.gif";
        chTypeOtherNode.NavigateUrl = "~/system/info/ChannelList.aspx?ChType=0";
        chTypeOtherNode.Target = "ContentIframe";
        tvNav.Nodes.Add(chTypeOtherNode);

        B_Channel channelBll = new B_Channel();
        B_Column columnBll = new B_Column();
        DataView channelDv = channelBll.GetList(false);

        for (int i = 0; i < tvNav.Nodes.Count-1; i++)
        {
            int chType = int.Parse(chTypeDt.Rows[i]["id"].ToString());

            DataTable chDt = channelDv.ToTable();

            DataView chTypeDv = new DataView(chDt);
            chTypeDv.RowFilter=string.Format("[chtype]={0}",chType);
            for (int j = 0; j < chTypeDv.Count; j++)
            {
                TreeNode channelNode = new TreeNode();
                channelNode.ToolTip = "频道右键操作$" + chTypeDv[j]["ChId"].ToString() + "$" + chTypeDv[j]["ChType"].ToString();
                channelNode.Text = chTypeDv[j]["ChName"].ToString();
                channelNode.ImageUrl = "~/system/images/folder.gif";
                channelNode.NavigateUrl = "~/system/info/ColumnList.aspx?ChId=" + chTypeDv[j]["ChId"];
                channelNode.Target = "ContentIframe";
                tvNav.Nodes[i].ChildNodes.Add(channelNode);
            }

            for (int j = 0; j < chTypeDv.Count; j++)
            {
                DataView dv = columnBll.GetColumnListByChannelId((int)chTypeDv[j]["ChId"]);
                DataTable dt = dv.ToTable();
                dv.Dispose();
                BindColumn(0, tvNav.Nodes[i].ChildNodes[j], dt, (int)chTypeDv[j]["ModelType"], (int)chTypeDv[j]["ChId"]);
            }
            chDt.Dispose();
            chTypeDv.Dispose();
        }
        DataTable chDt2 = channelDv.ToTable();
        DataView chTypeDv2 = new DataView(chDt2);
        chTypeDv2.RowFilter = "[chtype]=0 or [chtype] is null";
        for (int j = 0; j < chTypeDv2.Count; j++)
        {
            TreeNode channelNode = new TreeNode();
            channelNode.ToolTip = "频道右键操作$" + chTypeDv2[j]["ChId"].ToString() + "$" + chTypeDv2[j]["ChType"].ToString();
            channelNode.Text = chTypeDv2[j]["ChName"].ToString();
            channelNode.ImageUrl = "~/system/images/folder.gif";
            channelNode.NavigateUrl = "~/system/info/ColumnList.aspx?ChId=" + chTypeDv2[j]["ChId"];
            channelNode.Target = "ContentIframe";
            tvNav.Nodes[tvNav.Nodes.Count - 1].ChildNodes.Add(channelNode);
        }
        for (int j = 0; j < chTypeDv2.Count; j++)
        {
            DataView dv = columnBll.GetColumnListByChannelId((int)chTypeDv2[j]["ChId"]);
            DataTable dt = dv.ToTable();
            dv.Dispose();
            BindColumn(0, tvNav.Nodes[tvNav.Nodes.Count - 1].ChildNodes[j], dt, (int)chTypeDv2[j]["ModelType"], (int)chTypeDv2[j]["ChId"]);
        }
        chDt2.Dispose();
        chTypeDv2.Dispose();
    }
예제 #12
0
    private void PopulateDropDowns()
    {
        //getting all the drop downs and applying filter
        foreach (Control ctrl in pageControls)
        {
            if (ctrl.GetType().Name == "DropDownList")
            {
                DropDownList ddl = (DropDownList)ctrl;
                DataView dv = new DataView(lookUp, "ControlName='" + ddl.ID + "'", "SortOrder ", DataViewRowState.CurrentRows);

                if (dv.Count > 0)
                {
                    ddl.Items.Add(new ListItem("", ""));
                    ddl.AppendDataBoundItems = true;
                    ddl.DataSource = dv;
                    ddl.DataTextField = "FieldValue";
                    ddl.DataValueField = "FieldDescription";
                    ddl.DataBind();

                    //checking for duplicate values
                    Dictionary<string, string> dups = new Dictionary<string, string>();
                    int dupCount = 1;
                    foreach (ListItem liDups in ddl.Items)
                    {
                        if (dups.ContainsKey(liDups.Value))
                        {
                            liDups.Value += "~" + dupCount.ToString();
                            dupCount++;
                        }
                        else
                        {
                            dups.Add(liDups.Value, "");
                        }
                    }

                    //selecting the default value
                    string defaultValue = dv[0]["DefaultValue"] == DBNull.Value ? "" : dv[0]["DefaultValue"].ToString();
                    ListItem li = ddl.Items.FindByValue(defaultValue);
                    if (li != null)
                    {
                        li.Selected = true;
                        //break;
                    }
                }
                dv.Dispose();
            }
        }
    }
예제 #13
0
        public string bindPageInstitute(DataTable dtInstitute, DataTable dtInstAdmis)
        {
            string xAxis = "";
            string xData = "";
            string xData2 = "";

            StringBuilder builder = new StringBuilder();

            builder.Append("$(function () {");
            builder.Append("$('#container1').highcharts({").AppendLine();
            builder.Append("chart: {").AppendLine();
            builder.Append("type: 'bar'").AppendLine();
            builder.Append(" },").AppendLine();
            builder.Append("title: {").AppendLine();
            builder.Append("text: 'Institute Wise Admission (" + dtInstitute.Rows[0]["AcademicYear"].ToString() + ")' ").AppendLine();
            builder.Append(" },").AppendLine();
            builder.Append("subtitle: {").AppendLine();
            builder.Append("text: ''").AppendLine();
            builder.Append("},").AppendLine();
            builder.Append("xAxis: { type: 'category'").AppendLine();
            //for (int cnt = 0; cnt < dtResult.Rows.Count; cnt++)
            //{
            //    if (cnt == (dtResult.Rows.Count - 1))
            //    {
            //        xAxis = xAxis + "'" + dtResult.Rows[cnt]["Institute"].ToString() + "'";
            //    }
            //    else
            //        xAxis = xAxis + "'" + dtResult.Rows[cnt]["Institute"].ToString() + "',";
            //}
            //builder.Append("categories: [" + xAxis.ToString() + " ],").AppendLine();
            //builder.Append("crosshair: true").AppendLine();
            builder.Append(" },").AppendLine();
            builder.Append("yAxis: {  title: { text: 'No Of Students' }},").AppendLine();
            builder.Append("legend: { enabled: false },").AppendLine();
            builder.Append("tooltip: {headerFormat: '<span style='font-size:10px'>{point.key}</span><table>',").AppendLine();
            builder.Append("pointFormat: '<tr><td style='color:{series.color};padding:0'>{series.name}: </td>' +").AppendLine();
            builder.Append("'<td style='padding:0'><b>{point.y:.1f} Students </b></td></tr>',").AppendLine();
            builder.Append("footerFormat: '</table>', shared: true,useHTML: true },").AppendLine();
            builder.Append("plotOptions: { series: { pointPadding: 0, borderWidth: 0, dataLabels: { enabled: true } }},").AppendLine();
            //builder.Append("legend: {layout: 'vertical', align: 'right', verticalAlign: 'top', x: -40, y: 80, floating: true, borderWidth: 1, backgroundColor: ((Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'), shadow: true},").AppendLine();
            builder.Append("series: [{").AppendLine();
            builder.Append("name: 'Institute', colorByPoint: true,").AppendLine();

            for (int cnt = 0; cnt < dtInstitute.Rows.Count; cnt++)
            {
                DataView dv = new DataView(dtInstAdmis);
                dv.RowFilter = " Institute = '" + dtInstitute.Rows[cnt]["Institute"].ToString() + "'";
                DataTable dt = new DataTable();
                string dataInner = "";
                if (dv != null)
                {
                    dt = dv.ToTable();
                    dv.Dispose();

                    if (dt.Rows.Count > 0)
                    {
                        for (int cnt1 = 0; cnt1 < dt.Rows.Count; cnt1++)
                        {
                            if (cnt1 == (dt.Rows.Count - 1))
                            {
                                dataInner = dataInner + "" + " [ '" + dt.Rows[cnt1]["AdmissionType"].ToString() + "', " + dt.Rows[cnt1]["TotalStudent"].ToString() + "]";
                            }
                            else
                            {

                                dataInner = dataInner + "" + " [ '" + dt.Rows[cnt1]["AdmissionType"].ToString() + "', " + dt.Rows[cnt1]["TotalStudent"].ToString() + "],";
                            }
                        }
                    }
                    else
                    {
                        dataInner = "";
                    }
                }
                if (cnt == (dtInstitute.Rows.Count - 1))
                {
                    xData = xData + "" + " { name: '" + dtInstitute.Rows[cnt]["Institute"].ToString() + "', y: " + dtInstitute.Rows[cnt]["TotalStudent"].ToString() + ", drilldown: '" + dtInstitute.Rows[cnt]["Institute"].ToString() + "'}";

                    if (dataInner !="")
                        xData2 = xData2 + "" + " { name: '" + dtInstitute.Rows[cnt]["Institute"].ToString() + "', id: '" + dtInstitute.Rows[cnt]["Institute"].ToString() + "', data: [" + dataInner + " ]}";
                }
                else
                {
                    xData = xData + "" + " { name: '" + dtInstitute.Rows[cnt]["Institute"].ToString() + "', y: " + dtInstitute.Rows[cnt]["TotalStudent"].ToString() + ", drilldown: '" + dtInstitute.Rows[cnt]["Institute"].ToString() + "'},";
                    if (dataInner!="")
                        xData2 = xData2 + "" + " { name: '" + dtInstitute.Rows[cnt]["Institute"].ToString() + "', id: '" + dtInstitute.Rows[cnt]["Institute"].ToString() + "',data: [" + dataInner + " ]},";
                }
            }
            builder.Append("data: [" + xData + "]").AppendLine();
            builder.Append("}] ").AppendLine();
            builder.Append(", drilldown: { series: [").AppendLine();
            builder.Append("" + xData2 + "").AppendLine();
            builder.Append("] } ").AppendLine(); ///series End

            builder.Append("}); }); ").AppendLine();
            string innerString = builder.ToString().Replace("style='", "style=\"").Replace("'>", "\">");

            return innerString;
              //  System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Submitted", innerString, true);
        }
        private DataRow ObtenerEmpleadoPorIdEmpleado(Decimal ID_EMPLEADO)
        {
            Conexion conexion = new Conexion(Empresa);
            DataSet _dataSet = new DataSet();
            DataView _dataView = new DataView();
            DataTable _dataTable = new DataTable();
            DataRow _dataRow = null;
            String sql = null;

            sql = "usp_lps_nom_empleados_obtenerPorIdEmpleado " + ID_EMPLEADO.ToString();
            try
            {
                _dataSet = conexion.ExecuteReader(sql);
                _dataView = _dataSet.Tables[0].DefaultView;
                _dataTable = _dataView.Table;
                _dataRow = _dataTable.Rows[0];
            }
            catch (Exception e)
            {
                MensajeError = e.Message;
            }
            finally
            {
                conexion.Desconectar();
            }
            if (_dataSet != null) _dataSet.Dispose();
            if (_dataView != null) _dataView.Dispose();
            if (_dataTable != null) _dataTable.Dispose();
            return _dataRow;
        }
        public int GetfeederVerifywithCamera(string fid)
        {
            if (ds.Tables.Count == 0)
            {
                POPFeedersTable();
            }
            DataView dv = new DataView(ds.Tables[0]);
            dv.RowFilter = "feederNumber = " + fid;
            int returnval = 0;
            if (dv.Count > 0)
            {
                if (dv[0]["VerifywithCamera"].ToString().Equals("true")) {
                    returnval = 1;
                } else {
                    returnval = 0;
                }

            }
            dv.Dispose();
            return returnval;
        }
 private void bt_UnCheckAll_Click(object sender, RoutedEventArgs e)
 {
     // toggle selection on datagrid checkboxes
     foreach (DataRow row in dsData.Tables["Components"].Rows)
     {
         
             row["Pick"] = 0;
     }
     DataView dv = new DataView(dsData.Tables["Components"]);
     dv.RowFilter = "Pick = 1";
     lblInfo.Content = dv.Count.ToString() + " selected";
     dv.Dispose();
 }
예제 #17
0
파일: WS.cs 프로젝트: Brumiko/MobTrenisIS
    public string[] PllUpisiStavku(string skladisteOznaka, int godina, string broj, string robaBarkod, string lokacijaOznakaIzlaz, float kolicinaIzlaz, string lokacijaOznakaUlaz, float kolicinaUlaz, string mac, string matBroj, string lozinka)
    {
        int id = 0;
        string strGreska = "OK";
        float fltGreska = 0;

        // Kontrola jel PLL zaprti. Okay, zakrpa je JADNA zbog GOTO naredbe, ali mi se nije dalo zafrkavat s ifovima.
        //DataSet kontrolaPLLDS = PllDajPoSkladistu(skladisteOznaka);
        //if (kontrolaPLLDS != null)
        //{
        //    if (kontrolaPLLDS.Tables[0].Rows.Count != 1)
        //    {
        //        strGreska = "GreskaPriUpisu";
        //        kontrolaPLLDS.Dispose();
        //        goto Kraj;
        //    }
        //}
        //else
        //{
        //    strGreska = "GreskaPriUpisu";
        //    kontrolaPLLDS.Dispose();
        //    goto Kraj;
        //}
        // Kraj kontrole

        // - - Nova kontrola jel PLL zaprti, 8.1.2009 - -
        strGreska = PllProvjeri(skladisteOznaka, broj);
        if (strGreska != "OK")
        {
            goto Kraj;
        }
        // - - - - - - - - - - - - -

        if (JeAutenticiran(matBroj, lozinka, mac))
        {
            MobTransLokStaTA mobTransLokStaTA = new MobTransLokStaTA();
            decimal? decID = null;
            decimal? decKapacitet = null;

            #region Priprema parametara
            string lokIzlaz = null;
            if (lokacijaOznakaIzlaz != null && lokacijaOznakaIzlaz != String.Empty)
            {
                lokIzlaz = lokacijaOznakaIzlaz;
            }
            float? kolIzlaz = null;
            if (lokIzlaz != null)
            {
                kolIzlaz = kolicinaIzlaz;
            }

            string lokUlaz = null;
            if (lokacijaOznakaUlaz != null && lokacijaOznakaUlaz != String.Empty)
            {
                lokUlaz = lokacijaOznakaUlaz;
            }
            float? kolUlaz = null;
            if (lokUlaz != null)
            {
                kolUlaz = kolicinaUlaz;
            }
            #endregion

            #region Izlaz
            // Ako se radi o izlazu, treba provjeriti postoji li uopæe roba na toj lokaciji.
            if (lokIzlaz != null && lokUlaz == null)
            {
                DataSet ds = RobaDajLokacije(skladisteOznaka, robaBarkod, null);
                if (ds != null)
                {
                    DataView dv = new DataView(ds.Tables[0], "LokacijaOznaka='" + lokIzlaz + "'", "LokacijaOznaka", DataViewRowState.CurrentRows);
                    if (dv.Count == 1)
                    {
                        float fltRobaStanje = 0;
                        if (dv[0]["RobaStanje"].ToString() != String.Empty && dv[0]["RobaStanje"].ToString() != null)
                        {
                            fltRobaStanje = Convert.ToSingle(dv[0]["RobaStanje"]);
                        }
                        // Ako robe ima na lokaciji, treba provjeriti kolièinu za skidanje...
                        if (kolicinaIzlaz > fltRobaStanje)
                        {
                            strGreska = "PrevelikoIzuzimanje";
                            fltGreska = kolicinaIzlaz - fltRobaStanje;
                        }
                    }
                    else if (dv.Count == 0)
                    {
                        strGreska = "NemaNaLokaciji";
                    }
                    else
                    {
                        strGreska = "PogresanBrojLokacija";
                    }
                    dv.Dispose();
                }
                else
                {
                    strGreska = "GreskaPriDohvatuLokacija";
                }
                ds.Dispose();
            }
            #endregion

            #region Ulaz
            // Ako se radi o ulazu, treba provjeriti da li je roba prethodno izuzeta.
            else if (lokIzlaz == null && lokUlaz != null)
            {
                //string[] stanje = PllIzmjestenaRobaDajStanje(skladisteOznaka, godina, broj, null, robaBarkod, matBroj);
                string[] stanje = PllIzmjestenaRobaDajStanje(skladisteOznaka, godina, broj, null, robaBarkod, null);
                if (stanje[0] == "1")
                {
                    if (stanje[2] != String.Empty)
                    {
                        float fltStanje1 = 0;
                        if (stanje[1] != String.Empty)
                        {
                            fltStanje1 = Convert.ToSingle(stanje[1]);
                        }
                        if (kolicinaUlaz > Convert.ToSingle(stanje[2]) - fltStanje1)
                        {
                            strGreska = "PrevelikUlaz";
                            fltGreska = kolicinaUlaz - (Convert.ToSingle(stanje[2]) - fltStanje1);
                        }
                    }
                    else
                    {
                        strGreska = "NepostojeciIzlaz";
                    }
                }
                else
                {
                    strGreska = "GreskaPriDohvatuStanja";
                }
            }
            #endregion

            if (strGreska == "OK")
            {
                try
                {
                    mobTransLokStaTA.Insert(skladisteOznaka, godina.ToString(), broj, lokIzlaz, kolIzlaz, lokUlaz, kolUlaz, robaBarkod, mac, matBroj, out decID, out decKapacitet);
                    if (Convert.ToInt32(decID) == -2)
                    {
                        strGreska = "KapacitarnaGreska";
                    }
                }
                catch (Exception)
                {
                    strGreska = "GreskaPriUpisu";
                    decID = null;
                }
                finally
                {
                    mobTransLokStaTA.Dispose(); // Za otpuštanje table adaptera se brine garbage collector, ali ne šteti ako ga ruèno anuliramo.
                }
                if (decID != null)
                {
                    id = Convert.ToInt32(decID);
                }
                if (decKapacitet != null)
                {
                    fltGreska = Convert.ToSingle(decKapacitet);
                }
            }
        }

        Kraj:
        string[] upis = new string[3];
        upis[0] = strGreska;
        upis[1] = fltGreska.ToString();
        upis[2] = id.ToString();

        // < Štoperica>
        //TimeSpan intervalWS = DateTime.Now.Subtract(pocetakWS);
        //Kraj(id2, intervalWS.TotalMilliseconds, dogodilaSeGreska);
        // </štoperica>

        return upis;
    }
예제 #18
0
파일: B_Create.cs 프로젝트: suizhikuo/KYCMS
 private string GetIndexSpNav(string paramStr)
 {
     string paramValue = "";
     string str2 = "";
     string str3 = "";
     string str4 = "10";
     string str5 = "";
     this.GetParamValue(paramStr, "navcss", ref paramValue);
     this.GetParamValue(paramStr, "arrange", ref str2);
     this.GetParamValue(paramStr, "compart", ref str3);
     this.GetParamValue(paramStr, "navcount", ref str4);
     this.GetParamValue(paramStr, "target", ref str5);
     DataTable specials = this.SpecialBll.GetSpecials(0);
     DataView view = new DataView(specials);
     view.RowFilter = "islock=0";
     StringBuilder builder = new StringBuilder();
     for (int i = 0; i < view.Count; i++)
     {
         int specialId = (int)view[i]["ID"];
         string str6 = view[i]["SpecialCName"].ToString();
         if (str2 == "true")
         {
             if (i == int.Parse(str4))
             {
                 builder.Append("<a href='");
                 builder.Append(this.GetSpecialUrl(specialId, 1));
                 builder.Append("' target='");
                 builder.Append(str5);
                 builder.Append("' class='");
                 builder.Append(paramValue);
                 builder.Append("'>");
                 builder.Append(str6);
                 builder.Append("</a><br/>");
             }
             else if (i >= (view.Count - 1))
             {
                 builder.Append("<a href='");
                 builder.Append(this.GetSpecialUrl(specialId, 1));
                 builder.Append("' target='");
                 builder.Append(str5);
                 builder.Append("' class='");
                 builder.Append(paramValue);
                 builder.Append("'>");
                 builder.Append(str6);
                 builder.Append("</a>");
             }
             else
             {
                 builder.Append("<a href='");
                 builder.Append(this.GetSpecialUrl(specialId, 1));
                 builder.Append("' target='");
                 builder.Append(str5);
                 builder.Append("' class='");
                 builder.Append(paramValue);
                 builder.Append("'>");
                 builder.Append(str6);
                 builder.Append("</a>");
                 builder.Append(str3);
             }
         }
         else
         {
             builder.Append(str3);
             builder.Append("<a href='");
             builder.Append(this.GetSpecialUrl(specialId, 1));
             builder.Append("' target='");
             builder.Append(str5);
             builder.Append("' class='");
             builder.Append(paramValue);
             builder.Append("'>");
             builder.Append(str6);
             builder.Append("</a><br/>");
         }
     }
     specials.Dispose();
     view.Dispose();
     return builder.ToString();
 }
예제 #19
0
		public void TestDeleteClosed ()
		{
			DataView TestView = new DataView (dataTable);
			TestView.Dispose (); // Close the table
			TestView.Delete (0);
		}
예제 #20
0
파일: NewLog.cs 프로젝트: lexzh/Myproject
 public override void addLogMsg(DataTable dtLogResult)
 {
     if ((dtLogResult != null) && (dtLogResult.Rows.Count != 0))
     {
         try
         {
             bool flag = true;
             string str = null;
             DataView view = null;
             dtLogResult.Columns.Add(new DataColumn("ColLog"));
             dtLogResult.Columns.Add(new DataColumn("LocalCurTime"));
             view = new DataView(dtLogResult) {
                 RowFilter = base.m_dvLogData.RowFilter
             };
             int firstDisplayedScrollingRowIndex = base.dgvLogData.FirstDisplayedScrollingRowIndex;
             int count = view.Count;
             if (base.m_dvLogData.RowFilter.Length > 0)
             {
                 int length = dtLogResult.Select(base.m_dvLogData.RowFilter).Length;
             }
             this.execSetLaPlace(dtLogResult);
             if (base.m_dvLogData.Sort.Length == 0)
             {
                 base.m_dtLogData = dtLogResult.Clone();
                 base.m_dvLogData = new DataView(base.m_dtLogData, "", "LocalCurTime DESC,ReceTime DESC,OrderId DESC", DataViewRowState.CurrentRows);
                 base.dgvLogData.DataSource = base.m_dvLogData;
             }
             foreach (DataRow row in dtLogResult.Select(base.m_dvLogData.RowFilter))
             {
                 flag = true;
                 str = row["OrderId"].ToString();
                 if (dtLogResult.Columns.IndexOf("RespCode") >= 0)
                 {
                     this.CancelAlarmResponse(row);
                 }
                 if (base.m_dtLogData.Rows.Count > 0)
                 {
                     if (((Convert.ToInt32(row["msgType"]) == CmdParam.OrderType.Command) || (Convert.ToInt32(row["msgType"]) == CmdParam.OrderType.SendMsg)) && ((row["OrderName"].ToString() != "末次位置查询") && (row["OrderName"].ToString() != "提示信息")))
                     {
                         string filterExpression = string.Format("OrderId='{0}'", str);
                         string str3 = "";
                         foreach (DataRow row2 in base.m_dtLogData.Select(filterExpression))
                         {
                             row2["OrderResult"] = row["OrderResult"];
                             row2["CommFlag"] = row["CommFlag"];
                             str3 = row["Describe"].ToString().Trim();
                             if (str3.Length > 0)
                             {
                                 row2["Describe"] = str3;
                             }
                             flag = false;
                         }
                     }
                     else if ((Convert.ToInt32(row["msgType"]) == CmdParam.OrderType.Terminal) && ((row["OrderName"].ToString().Equals("设置多功能区域报警应答", StringComparison.OrdinalIgnoreCase) || row["OrderName"].ToString().Equals("设置车台分路段超速报警应答", StringComparison.OrdinalIgnoreCase)) || row["OrderName"].ToString().Equals("设置取消区域报警应答", StringComparison.OrdinalIgnoreCase)))
                     {
                         string str4 = string.Format("OrderId='{0}' and OrderName='{1}'", str, row["OrderName"].ToString());
                         string str5 = "";
                         foreach (DataRow row3 in base.m_dtLogData.Select(str4))
                         {
                             row3["OrderResult"] = row["OrderResult"];
                             row3["CommFlag"] = row["CommFlag"];
                             str5 = row["Describe"].ToString().Trim();
                             if (str5.Length > 0)
                             {
                                 row3["Describe"] = str5;
                             }
                             flag = false;
                         }
                     }
                     this.BatchName(row, str);
                 }
                 if (flag)
                 {
                     int num2 = base.dgvLogData.SelectedRows.Count;
                     row["LocalCurTime"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                     base.m_dtLogData.ImportRow(row);
                     if (num2 == 0)
                     {
                         base.dgvLogData.ClearSelection();
                     }
                     if (base.m_dtLogData.Rows.Count > base.iMaxLogCnt)
                     {
                         base.m_dvLogData.Delete(base.iMaxLogCnt);
                     }
                 }
             }
             str = null;
             if (firstDisplayedScrollingRowIndex >= 0)
             {
                 base.dgvLogData.FirstDisplayedScrollingRowIndex = firstDisplayedScrollingRowIndex;
             }
             base.dgvLogData.Refresh();
             view.Dispose();
             view = null;
         }
         catch (Exception exception)
         {
             if (Variable.bLogin)
             {
                 Record.execFileRecord("最新日志添加操作", exception.Message);
             }
         }
         finally
         {
             if (dtLogResult != null)
             {
                 dtLogResult = null;
             }
         }
     }
 }
예제 #21
0
        public Proceso ObteneroPorId(tabla.proceso procesoManualDeServicio, String empresa)
        {
            Conexion datos = new Conexion(empresa);
            DataSet dataSet = new DataSet();
            DataView dataView = new DataView();
            DataTable dataTable = new DataTable();
            String sql = null;
            String proceso = Homologar(procesoManualDeServicio);

            sql = "usp_oper_permisos_obtenerPorProceso ";
            sql += "'" + proceso + "'";

            try
            {
                dataSet = datos.ExecuteReader(sql);
                dataView = dataSet.Tables[0].DefaultView;
                dataTable = dataView.Table;
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            finally
            {
                Cargar(dataTable);
                if (dataTable != null) dataTable.Dispose();
                if (dataView != null) dataView.Dispose();
                if (dataSet != null) dataSet.Dispose();
                datos.Desconectar();
            }
            return this;
        }
예제 #22
0
 protected void dgTotalConsultaCliente_SortCommand(object source, DataGridSortCommandEventArgs e)
 {
     try
     {
         DataView dv = new DataView((DataTable) this.Session["DT_TOTAL_CONSULTA_CLIENTE"]) {
             Sort = e.SortExpression
         };
         this.mpeTotalCliente.Show();
         this.dgTotalConsultaCliente.DataSource = dv;
         this.dgTotalConsultaCliente.DataBind();
         dv.Dispose();
     }
     catch (Exception exception1)
     {
         ProjectData.SetProjectError(exception1);
         Exception ex = exception1;
         throw new Exception(GlobalPage.MsgErro(((Usuario)this.Session["USUARIO"]).Cliente.Nome.ToUpper(), ((Usuario)this.Session["USUARIO"]).DsLogin.ToUpper(), "intouch", "RelatorioClean.aspx", "dgTotalConsultaCliente_SortCommand", ex.Message, ex.StackTrace, this.Form.Controls));
     }
 }
        private void _dgComponents_SelectionChanged(object sender, SelectionChangedEventArgs e)

        {
            DataView dv = new DataView(dsData.Tables["Components"]);
            dv.RowFilter = "Pick = 1";
            lblInfo.Content = dv.Count.ToString() + " selected";
            dv.Dispose();
        }
예제 #24
0
        public bool GetComponentTapeFeeder(string fid)
        {
            if (dscomponents.Tables.Count == 0)
            {
                POPComponentsTable();
            }
            DataView dv = new DataView(dscomponents.Tables[0]);
            dv.RowFilter = "ComponentCode = " + fid;
            bool returnval = false;
            if (dv.Count > 0)
            {

                if (dv[0]["TapeFeeder"].ToString().Equals("True"))
                {
                    returnval = true;
                }
                else
                {
                    returnval = false;
                }
            }
            dv.Dispose();
            return returnval;
        }
예제 #25
0
파일: B_Create.cs 프로젝트: suizhikuo/KYCMS
 private string Index_Ch_GetNav(string paramStr)
 {
     string paramValue = "";
     string str2 = "";
     string str3 = "";
     string str4 = "10";
     string str5 = "";
     this.GetParamValue(paramStr, "navcss", ref paramValue);
     this.GetParamValue(paramStr, "arrange", ref str2);
     this.GetParamValue(paramStr, "compart", ref str3);
     this.GetParamValue(paramStr, "navcount", ref str4);
     this.GetParamValue(paramStr, "target", ref str5);
     DataTable table = this.ChannelBll.GetList(false).ToTable();
     DataView view = new DataView(table);
     view.RowFilter = "isdisabled=0";
     StringBuilder builder = new StringBuilder();
     for (int i = 1; i <= view.Count; i++)
     {
         int chId = (int)view[i - 1]["chid"];
         string str6 = view[i - 1]["content"].ToString();
         string str7 = view[i - 1]["chname"].ToString();
         if (str2 == "true")
         {
             if (((i % int.Parse(str4)) == 0) && (i != view.Count))
             {
                 builder.Append(string.Format("<a href=\"{0}\" target=\"{1}\" title=\"{2}\" class=\"{3}\">{4}</a><br/>", new object[] { this.GetChannelUrl(chId), str5, str6, paramValue, str7 }));
             }
             else if (i == view.Count)
             {
                 builder.Append(string.Format("<a href=\"{0}\" target=\"{1}\" title=\"{2}\" class=\"{3}\">{4}</a>", new object[] { this.GetChannelUrl(chId), str5, str6, paramValue, str7 }));
             }
             else
             {
                 builder.Append(string.Format("<a href=\"{0}\" target=\"{1}\" title=\"{2}\" class=\"{3}\">{4}</a>{5}", new object[] { this.GetChannelUrl(chId), str5, str6, paramValue, str7, str3 }));
             }
         }
         else
         {
             builder.Append(string.Format("{0}<a href=\"{1}\" target=\"{2}\" title=\"{3}\" class=\"{4}\">{5}</a></br>", new object[] { str3, this.GetChannelUrl(chId), str5, str6, paramValue, str7 }));
         }
     }
     table.Dispose();
     view.Dispose();
     return builder.ToString();
 }
예제 #26
0
 public override void addLogMsg(DataTable dtLogResult)
 {
     if ((dtLogResult == null) || (dtLogResult.Rows.Count == 0))
     {
         base.txtNewLogCnt2.Text = "0";
     }
     else
     {
         DataView dv = null;
         try
         {
             dtLogResult.Columns.Add(new DataColumn("ColLog"));
             dv = new DataView(dtLogResult) {
                 RowFilter = base.m_dvLogData.RowFilter
             };
             int firstDisplayedScrollingRowIndex = base.dgvLogData.FirstDisplayedScrollingRowIndex;
             int count = dv.Count;
             if (base.m_dvLogData.Sort.Length == 0)
             {
                 base.m_dtLogData = dtLogResult.Clone();
                 if (Variable.sShowTogether.Equals("0"))
                 {
                     base.m_dvLogData = new DataView(base.m_dtLogData, "", "ReceTime DESC", DataViewRowState.CurrentRows);
                 }
                 else
                 {
                     dtLogResult.PrimaryKey = new DataColumn[] { dtLogResult.Columns["CarId"] };
                     base.m_dtLogData = dtLogResult.Clone();
                     base.m_dvLogData = new DataView(base.m_dtLogData, "", "CarNum", DataViewRowState.CurrentRows);
                 }
                 base.dgvLogData.DataSource = base.m_dvLogData;
             }
             if (Variable.sShowTogether.Equals("0"))
             {
                 this.addData(count, firstDisplayedScrollingRowIndex, dv);
             }
             else
             {
                 foreach (DataRow row in dtLogResult.Rows)
                 {
                     string key = row["CarId"].ToString();
                     if (base.m_dtLogData.Rows.Contains(key))
                     {
                         this.updateData(row);
                     }
                     else
                     {
                         base.m_dtLogData.Rows.Add(row.ItemArray);
                     }
                 }
                 base.m_dvLogData = new DataView(base.m_dtLogData, "", "CarNum", DataViewRowState.CurrentRows);
             }
             dv.Dispose();
             dv = null;
         }
         catch (Exception exception)
         {
             if (Variable.bLogin)
             {
                 Record.execFileRecord("最新位置日志添加操作", exception.Message);
             }
         }
     }
 }
        private void worker_DoWork(object sender, DoWorkEventArgs e)
        {
           // run all background tasks here
            BackgroundWorker worker = sender as BackgroundWorker;
            DataTable dtComponents = dsData.Tables["Components"];
            DataView dv = new DataView(dtComponents);
            dv.RowFilter = "Pick = 1";
            int currentrow = 0;
            int totalrows = dv.Count;

            Nozzle1Xoffset = dh.Nozzle1Xoffset;
            Nozzle1Yoffset = dh.Nozzle1Yoffset;
            Nozzle2Xoffset = dh.Nozzle2Xoffset;
            Nozzle2Yoffset = dh.Nozzle2Yoffset;

            if (totalrows > 0)
            {

                /* Components table columns
                    ComponentCode
                    ComponentName
                    PlacementX
                    PlacementY
                    PlacementRotate
                    PlacementNozzle
                 
                 * component list
                 * ComponentCode
                 * ComponentValue
                 * Package
                 * 
                 * PlacementHeight
                 * FeederHeight
                 * FeederX
                 * FeederY
                 * VerifywithCamera
                 * TapeFeeder
               
                  
                 * */
                double pcbHeight = double.Parse(dsData.Tables["BoardInfo"].Rows[0][1].ToString());
               
                double feedrate = 20000;
                double feederPosX = 0;
                double feederPosY = 0;
                double feederPosZ = 0;
                double placePosX = 0;
                double placePosY = 0;
                //double placePosZ = 0;
               // double placePosA = 0;
               // double placePosRotateZ = 0;
               // double placePosRotateB = 0;
                double ComponentRotation = 0;
                double PlacementHeight = 0;
                int PlacementNozzle = 1;
                bool TapeFeeder = false;

                while (currentrow < totalrows)
                {

                    if (backgroundWorkerBuildPCB.CancellationPending)
                    {
                        e.Cancel = true;
                        dv.Dispose();
                        break;
                    }
                    PlacementNozzle = int.Parse(dv[currentrow]["PlacementNozzle"].ToString());


                    feederPosX = CalcXLocation(comp.GetFeederX(dv[currentrow]["ComponentCode"].ToString()),PlacementNozzle);
                    feederPosY = CalcYLocation(comp.GetFeederY(dv[currentrow]["ComponentCode"].ToString()),PlacementNozzle);

                    feederPosZ = comp.GetFeederHeight(dv[currentrow]["ComponentCode"].ToString());
                    PlacementHeight = comp.GetPlacementHeight(dv[currentrow]["ComponentCode"].ToString()) - pcbHeight;

                    TapeFeeder = comp.GetComponentTapeFeeder(dv[currentrow]["ComponentCode"].ToString()); 

                    placePosX = CalcXLocation(double.Parse(dv[currentrow]["PlacementX"].ToString()),PlacementNozzle);
                    placePosY = CalcYLocation(double.Parse(dv[currentrow]["PlacementY"].ToString()), PlacementNozzle);

                    ComponentRotation = double.Parse(dv[currentrow]["PlacementRotate"].ToString());


                    PlacementNozzle = int.Parse(dv[currentrow]["PlacementNozzle"].ToString());


                    if (currentrow == 0)
                    {
                        SetFeederOutputs(comp.GetFeederID(dv[currentrow]["ComponentCode"].ToString())); // send feeder to position
                    }
                   


                    kf.MoveSingleFeed(feedrate, feederPosX, feederPosY, ClearHeight, ClearHeight, 0, 0);


                    if (comp.GetComponentTapeFeeder(dv[currentrow]["ComponentCode"].ToString()))
                    {

                        while (!usbController.getFeederReadyStatus())
                        {
                            Thread.Sleep(10);
                        }
                        Thread.Sleep(50);
                        // use picker 1
                        kf.MoveSingleFeed(feedrate, feederPosX, feederPosY, feederPosZ, ClearHeight, 0, 0);
                        Thread.Sleep(200);
                        // go down and turn on suction
                        usbController.setVAC1(true);
                        Thread.Sleep(150);
                        kf.MoveSingleFeed(feedrate, feederPosX, feederPosY, ClearHeight, ClearHeight, 0, 0);

                    }
                    else
                    {
                        // use picker 2
                        while (usbController.CheckChipMotorRunning())
                        {
                            Thread.Sleep(10);
                        }
                        kf.MoveSingleFeed(feedrate, feederPosX, feederPosY, ClearHeight, feederPosZ, 0, 0);
                        Thread.Sleep(200);

                        usbController.setVAC2(true);
                        Thread.Sleep(300);
                        kf.MoveSingleFeed(feedrate, feederPosX, feederPosY, ClearHeight, ClearHeight, 0, 0);
                    }
                    // send picker to pick next item
                    if (currentrow >= 0 && (currentrow + 1) < totalrows)
                    {
                        Thread.Sleep(100);
                        Thread.Sleep(100);


                        SetFeederOutputs(comp.GetFeederID(dv[currentrow + 1]["ComponentCode"].ToString())); // send feeder to position
                    }

                    // rotate head


                    //SetResultsLabelText("Placing Component");
                    if (comp.GetComponentTapeFeeder(dv[currentrow]["ComponentCode"].ToString()))
                    {

                        kf.MoveSingleFeed(feedrate, placePosX, placePosY, ClearHeight, ClearHeight, 0, ComponentRotation);
                       
                        kf.MoveSingleFeed(feedrate, placePosX, placePosY, PlacementHeight, ClearHeight, 0, ComponentRotation);
                        Thread.Sleep(200);
                        usbController.setVAC1(false);
                        Thread.Sleep(50);
                        kf.MoveSingleFeed(feedrate, placePosX, placePosY, ClearHeight, ClearHeight, 0, ComponentRotation);

                    }
                    else
                    {
                        // use picker 2  CalcXwithNeedleSpacing

                        kf.MoveSingleFeed(feedrate, placePosX, placePosY, ClearHeight, ClearHeight, ComponentRotation, 0);
                        Thread.Sleep(200);
                        kf.MoveSingleFeed(feedrate, placePosX, placePosY, ClearHeight, PlacementHeight, ComponentRotation, 0);
                        // go down and turn off suction
                        Thread.Sleep(300);
                        
                        usbController.setVAC2(false);
                        Thread.Sleep(200);
                        kf.MoveSingleFeed(feedrate, placePosX, placePosY, ClearHeight, ClearHeight, ComponentRotation, 0);

                    }

                    currentrow++;
                   
                }
                


            }
            else
            {
                MessageBox.Show("Board file not loaded");
            }
            backgroundWorkerBuildPCB.CancelAsync();
            usbController.setResetFeeder();
            usbController.RunVibrationMotor(MotorRunLoop);
            kf.RunHomeAll();
           
          
            dv.Dispose();
            dtComponents.Dispose();
            
        }
예제 #28
0
    /// <summary>
    /// BUTTON 上面的存檔鈕
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void but_Up_Save_Click(object sender, EventArgs e)
    {
        #region
        //System.Threading.Thread.Sleep(2000);

        try
        {
            #region 檢查欄位

            System.Text.StringBuilder sb = new System.Text.StringBuilder();

            if (this.slp_Up_CHAN_NO.Text.Trim() == string.Empty) { sb.Append("\"通路\"欄位尚未設定\\r\\n"); }
            if (this.slp_Z_O.Text.Trim() == string.Empty) { sb.Append("\"營業所\"欄位尚未設定\\r\\n"); }
            if (this.slp_STORE.Text.Trim() == string.Empty) { sb.Append("\"門市\"欄位尚未設定\\r\\n"); }
            if (this.slp_Up_BUSDATE.Text.Trim() == string.Empty) { sb.Append("\"處理日期\"欄位尚未設定\\r\\n"); }
            if (this.txt_ANSWER_TIME.Text.Trim() == string.Empty) { sb.Append("\"接聽時間\"欄位尚未設定\\r\\n"); }
            if (this.slp_SAL_ID.Text.Trim() == string.Empty) { sb.Append("\"營業人員\"欄位尚未設定\\r\\n"); }
            if (this.slp_BUSUID.Text.Trim() == string.Empty) { sb.Append("\"處理人員\"欄位尚未設定\\r\\n"); }
            // 2009-12-10 cyhsu :Insert 才檢查路線路順,因為歷史資料可能會沒有路線路順
            if (this.hid_Page_Status.Value == "INSERT")
            {
                if (this.txt_ROUTD_ID.Text.Trim() == string.Empty) { sb.Append("\"路線\"欄位尚未設定\\r\\n"); }
                if (this.txt_ROUTD_STEP.Text.Trim() == string.Empty) { sb.Append("\"路順\"欄位尚未設定\\r\\n"); }
            }
            if (this.txt_DEAL_CONTENT.Text.Trim() == string.Empty) { sb.Append("\"處理內容\"欄位尚未設定\\r\\n"); }
            if (this.chkbl_Detail.SelectedIndex == -1) { sb.Append("\"服務項目\"[線上加量-D儲區]~[退返品查詢]至少必須勾選一個項目"); }
            if (GetStringLen(txt_DEAL_CONTENT.Text) > 600) { sb.Append("\"處理內容\"欄位資料長度太長\\r\\n"); }

            if (sb.ToString() != string.Empty)
            {
                ScriptManager.RegisterStartupScript(this.up_Button, this.GetType(), "TO_CRM011.aspx", "alert('" + sb.ToString() + "')", true);

                #region 設定頁面模式

                this.hid_Page_Status.Value = "INSERT";
                this.txt_Page_Status.Text = "INSERT";

                #endregion

                return;
            }

            #endregion

            int i_Return_Id = 0;
            BCO.RecordCRMRecord bco = new BCO.RecordCRMRecord(ConntionDB);

            ArrayList ParameterList = new ArrayList();//20091117

            if (this.hid_Page_Status.Value == "INSERT")
            {
                #region 整理明細服務項目資料

                //取得 VDS_CRM_RECORD_DETL 的 SCHEMA
                //並將使用者選取資料放入 TEMP_TABLE

                ParameterList.Clear();
                ParameterList.Add(Session["UID"].ToString());
                ParameterList.Add(DateTime.Now);

                DataTable dt_Detail = bco.QuerySwitch(BCO.RecordCRMRecord.QueryType.CRM011_DETL_SCHEMA, ParameterList);
                DateTime d_Date_Now = DateTime.Now;

                foreach (ListItem li in this.chkbl_Detail.Items)
                {
                    if (li.Selected == true)
                    {
                        DataRow dRow = dt_Detail.NewRow();
                        dRow["CREATEDATE"] = d_Date_Now;
                        dRow["CREATEUID"] = Session["UID"].ToString();
                        dRow["UPDATEDATE"] = d_Date_Now;
                        dRow["UPDATEUID"] = Session["UID"].ToString();
                        dRow["ONLINE_NO"] = li.Value;
                        dRow["FLAG"] = 1;

                        dt_Detail.Rows.Add(dRow);
                    }
                }

                #endregion

                #region 處理新增資料

                ParameterList.Clear();
                ParameterList.Add(DateTime.ParseExact(this.slp_Up_BUSDATE.Text, "yyyy/MM/dd", null));//BUSDATE
                ParameterList.Add(this.slp_BUSUID.Text.Trim());//BUSUID
                ParameterList.Add(d_Date_Now);//CREATEDATE
                ParameterList.Add(Session["UID"].ToString());//CREATEUID
                ParameterList.Add(d_Date_Now);//UPDATEDATE
                ParameterList.Add(Session["UID"].ToString());//UPDATEUID
                ParameterList.Add(1);//STATUS
                ParameterList.Add(1);//ENABLE
                ParameterList.Add(this.slp_Up_CHAN_NO.Text.Trim());//CHAN_NO
                ParameterList.Add(this.slp_STORE.Text.Trim());//STORE
                ParameterList.Add(DateTime.ParseExact(this.txt_ANSWER_TIME.Text.Substring(0, 2) + ":" + txt_ANSWER_TIME.Text.Substring(2).Trim(), "HH:mm", null));//ANSWER_TIME ,yyyy/MM/dd HH:mm:ss
                ParameterList.Add(this.txt_STORE_FAX_AREA.Text.Trim());//FAX_AREA
                ParameterList.Add(this.txt_STORE_FAX_NO.Text.Trim());//FAX_NO
                ParameterList.Add(this.txt_DEAL_CONTENT.Text.Trim());//DEAL_CONTENT
                ParameterList.Add(Session["UID"].ToString());//V_LOG_UPDATEUID
                ParameterList.Add(DateTime.Now);//D_LOG_UPDATEDATE

                i_Return_Id = bco.CreateCRMRecord(ParameterList, null, dt_Detail);

                #endregion
            }
            else if (this.hid_Page_Status.Value == "EDIT")
            {
                #region 整理明細服務項目資料

                DataSet ds_OldData = new DataSet();
                DateTime d_Date_Now = DateTime.Now;

                #region 使用XML轉回DataSet

                System.IO.StringReader sr_OldData = new System.IO.StringReader(xml_OLDData.InnerHtml);
                ds_OldData.ReadXml(sr_OldData);

                #endregion

                #region 新增一個欄位,記錄狀態


                DataColumn dColum = new DataColumn();
                dColum.ColumnName = "STATUS";
                dColum.DataType = System.Type.GetType("System.String");
                ds_OldData.Tables["VDS_CRM_RECORD_DETL"].Columns.Add(dColum);

                #endregion

                #region 比對ds_OldData檔與CheckBox的資料,如果ds_OldData有CheckBox沒有,則註記該筆資料被使用者刪除


                foreach (DataRow dRow in ds_OldData.Tables["VDS_CRM_RECORD_DETL"].Rows)
                {
                    if (this.chkbl_Detail.Items.FindByValue(dRow["ONLINE_NO"].ToString()).Selected == false)
                    { //如果使用者沒有勾選該筆資料,則將該筆資料從ds_OldData中移除

                        dRow["STATUS"] = "DELETE";
                    }
                }

                #endregion

                #region 比對CheckBox與ds_OldData檔的資料,如果CheckBox有ds_OldData沒有,則新增該筆資料進入ds_OldData,且註記該筆資料被使用者新增


                foreach (ListItem li in this.chkbl_Detail.Items)//畫面上使用者選的通路
                {
                    if (li.Selected == true)
                    {
                        DataView dv_Detail = new DataView();
                        dv_Detail.Table = ds_OldData.Tables["VDS_CRM_RECORD_DETL"].Copy();

                        dv_Detail.RowFilter = "ONLINE_NO = '" + li.Value + "'";

                        if (dv_Detail.Count == 0)
                        {
                            DataRow dRow_New = (DataRow)ds_OldData.Tables["VDS_CRM_RECORD_DETL"].NewRow();

                            dRow_New["CREATEDATE"] = d_Date_Now;
                            dRow_New["CREATEUID"] = Session["UID"].ToString();
                            dRow_New["UPDATEDATE"] = d_Date_Now;
                            dRow_New["UPDATEUID"] = Session["UID"].ToString();
                            dRow_New["ONLINE_NO"] = li.Value;
                            dRow_New["FLAG"] = 1;
                            dRow_New["STATUS"] = "ADD";

                            ds_OldData.Tables["VDS_CRM_RECORD_DETL"].Rows.Add(dRow_New);
                        }

                        dv_Detail.Dispose();
                    }//if
                }//foreach

                #endregion

                #endregion

                #region 處理更新資料

                ParameterList.Clear();
                //新資料

                ParameterList.Add(this.txt_DEAL_CONTENT.Text.Trim());
                ParameterList.Add(Session["UID"].ToString());
                ParameterList.Add(DateTime.Now);

                //舊資料

                ParameterList.Add(ds_OldData.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["ID"]);
                ParameterList.Add(ds_OldData.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["CHAN_NO"]);
                ParameterList.Add(ds_OldData.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["CODE"]);
                ParameterList.Add(ds_OldData.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["STORE"]);
                ParameterList.Add(ds_OldData.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["BUSDATE"]);
                ParameterList.Add(ds_OldData.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["ANSWER_TIME"]);
                ParameterList.Add(ds_OldData.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["BUSUID"]);
                ParameterList.Add(ds_OldData.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["FAX_AREA"]);
                ParameterList.Add(ds_OldData.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["FAX_NO"]);
                ParameterList.Add(ds_OldData.Tables["VDS_CRM_RECORD_MAIN"].Rows[0]["DEAL_CONTENT"]);

                i_Return_Id = bco.UpdateCRMRecord(ParameterList, null, ds_OldData.Tables["VDS_CRM_RECORD_DETL"]);

                #endregion
            }

            #region 新增 & 更新後處理


            if (i_Return_Id > 0)//代表新增或更新成功
            {

                ParameterList.Clear();
                ParameterList.Add(Session["UID"].ToString());
                aryParamsPKey = bco.QueryIDForBROWSER(ParameterList);

                s_ID = i_Return_Id.ToString();

                QueryDataAndSetControls();


                #region 設定 PageStatus & Button 狀態


                string s_Page_Status = string.Empty;
                s_Page_Status = this.hid_Page_Status.Value;

                this.hid_Page_Status.Value = "VIEW";
                this.txt_Page_Status.Text = "VIEW";

                #endregion

                if (s_Page_Status == "INSERT")
                {//在新增模式下按下"存檔"鈕

                    System.Web.UI.ScriptManager.RegisterStartupScript(this.up_Button, this.GetType(), "TO_CRM011.aspx", "alert('新增成功')", true);
                }
                else if (s_Page_Status == "EDIT")
                {//在編輯模式下按下"存檔"鈕

                    System.Web.UI.ScriptManager.RegisterStartupScript(this.up_Button, this.GetType(), "TO_CRM011.aspx", "alert('更新成功')", true);
                }
            }
            else
            {
                if (this.hid_Page_Status.Value == "INSERT")
                {//在新增模式下按下"存檔"鈕

                    System.Web.UI.ScriptManager.RegisterStartupScript(this.up_Button, this.GetType(), "TO_CRM011.aspx", "alert('新增失敗')", true);
                }
                else if (this.hid_Page_Status.Value == "EDIT")
                {//在編輯模式下按下"存檔"鈕

                    System.Web.UI.ScriptManager.RegisterStartupScript(this.up_Button, this.GetType(), "TO_CRM011.aspx", "alert('更新失敗')", true);
                }
            }

            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
        finally { GetPageDefault(); }
        #endregion
    }
예제 #29
0
        /// <summary>
        /// Updates the Page sequence
        /// </summary>
        /// <param name="parentSiteUrl">Site URL.</param>
        /// <param name="listName">List Name.</param>
        /// <param name="auditListName">Name of the audit list.</param>
        /// <param name="dvUpdateListitems">DataView.</param>
        /// <param name="actionPerformed">Audit Action ID.</param>
        /// <param name="userName">Name of the user.</param>
        public void UpdateChapterSequence(string parentSiteUrl, string listName, string auditListName,
            DataView dvUpdateListitems, string actionPerformed, string userName)
        {
            objCommonDAL = new CommonDAL();

            objCommonDAL.UpdateSequence(parentSiteUrl, listName, dvUpdateListitems, "Chapter_Sequence");
            if (dvUpdateListitems != null && dvUpdateListitems.Count > 0)
            {
                for (int rowIndex = 0; rowIndex < dvUpdateListitems.Count; rowIndex++)
                {
                    objCommonDAL.UpdateListAuditHistory(parentSiteUrl, auditListName,
                        int.Parse(dvUpdateListitems[rowIndex]["ID"].ToString()), userName, actionPerformed);
                }
            }
            if (dvUpdateListitems != null)
                dvUpdateListitems.Dispose();
        }
예제 #30
0
		public void TestDeleteClosed ()
		{
			DataView TestView = new DataView (dataTable);
			TestView.Dispose (); // Close the table
			TestView.Delete (0); // cannot access to item at 0.
		}
예제 #31
0
        private void backgroundWorkerDoCommand_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker = sender as BackgroundWorker;
            DataView rundata = new DataView();
            rundata = dtom3.ConvertToGCode(dataGridView1, Double.Parse(ribbonTextBoxBoardOffsetX.TextBoxText), Double.Parse(ribbonTextBoxBoardOffsetY.TextBoxText));
             double feedrate = double.Parse(ribbonTextBoxFeedRate.TextBoxText);

            int currentrow = 0;
            int totalrows = rundata.Count;
            if (totalrows > 0)
            {
                // MessageBox.Show(totalrows.ToString());
              //  RunMach3Command(Script, "G01 B0 C0");

                /* table columns
                 RefDes
                    Type
                    PosX
                    PosY
                    ComponentRotation
                    ComponentValue
                    feederNumber
                    Code

                    ComponentHeight
                    DefaultRotation
                    VerifywithCamera
                    TapeFeeder

                    feederPosX
                    feederPosY
                    feederPosZ
                    PickPlusChipHeight
                 * */

                double progresspert = 0;
                double progresspertcalc = 100 / totalrows;

                double feederPosX = 0;
                double feederPosY = 0;
                double feederPosZ = 0;
                double placePosX = 0;
                double placePosY = 0;

                double ComponentRotation = 0;
                double DefaultRotation = 0;
                double componentHeight = 0;
                double newrotation = 0;
                while (currentrow < totalrows)
                {

                    if (backgroundWorkerDoCommand.CancellationPending)
                    {
                        e.Cancel = true;
                        SetCurrentCommandText("Stopped");

                        rundata.Dispose();
                        break;
                    }

                    feederPosX = double.Parse(rundata[currentrow]["feederPosX"].ToString()) + Xoffset;
                    feederPosY = double.Parse(rundata[currentrow]["feederPosY"].ToString()) + Yoffset;
                    feederPosZ = double.Parse(rundata[currentrow]["feederPosZ"].ToString());
                    placePosX = double.Parse(rundata[currentrow]["PosX"].ToString()) + Xoffset;
                    placePosY = double.Parse(rundata[currentrow]["PosY"].ToString()) + Yoffset;

                    ComponentRotation = double.Parse(rundata[currentrow]["ComponentRotation"].ToString());
                    DefaultRotation = double.Parse(rundata[currentrow]["DefaultRotation"].ToString());

                    componentHeight = double.Parse(rundata[currentrow]["ComponentHeight"].ToString());

                    if (currentrow == 0)
                    {
                        SetFeederOutputs(Int32.Parse(rundata[currentrow]["FeederNumber"].ToString())); // send feeder to position
                    }
                    SetCurrentCommandText("Feeder Activate");
                    SetCurrentCommandText(rundata[currentrow]["RefDes"].ToString());
                    StetActiveComponentText(rundata[currentrow]["RefDes"].ToString());

                    kf.MoveSingleFeed(feedrate, feederPosX, feederPosY, ClearHeight, ClearHeight, 0, 0);

                    SetCurrentCommandText("Picking Component");
                    if (rundata[currentrow]["TapeFeeder"].ToString().Equals("True"))
                    {

                        while (!usbController.getFeederReadyStatus())
                        {
                            Thread.Sleep(10);
                        }
                        Thread.Sleep(50);
                        // use picker 1
                        kf.MoveSingleFeed(feedrate, feederPosX, feederPosY, CalcAZHeight(feederPosZ), ClearHeight, 0, 0);
                        Thread.Sleep(50);
                        // go down and turn on suction
                        ChangeVacOutput(1, true);
                        Thread.Sleep(50);
                        kf.MoveSingleFeed(feedrate, feederPosX, feederPosY, ClearHeight, ClearHeight, 0, 0);

                    }
                    else
                    {
                        // use picker 2
                        kf.MoveSingleFeed(feedrate, feederPosX, feederPosY, ClearHeight, CalcAZHeight(feederPosZ), 0, 0);
                        Thread.Sleep(50);
                        ChangeVacOutput(2, true);
                        //Thread.Sleep(500);
                        Thread.Sleep(50);
                        kf.MoveSingleFeed(feedrate, feederPosX, feederPosY, ClearHeight, ClearHeight, 0, 0);
                    }
                    // send picker to pick next item
                    if (currentrow >= 0 && (currentrow + 1) < totalrows)
                    {
                        Thread.Sleep(100);
                        SetFeederOutputs(Int32.Parse(rundata[currentrow + 1]["FeederNumber"].ToString())); // send feeder to position
                    }

                    // rotate head

                    SetResultsLabelText("Placing Component");
                    if (rundata[currentrow]["TapeFeeder"].ToString().Equals("True"))
                    {
                        // use picker 1
                        if (DefaultRotation != ComponentRotation)
                        {
                            newrotation = DefaultRotation + ComponentRotation;
                            if (ComponentRotation == 0)
                            {
                                newrotation = DefaultRotation;

                            }
                            kf.MoveSingleFeed(feedrate, placePosX, placePosY, ClearHeight, ClearHeight, 0, newrotation);
                        }
                        else
                        {
                            kf.MoveSingleFeed(feedrate, placePosX, placePosY, ClearHeight, ClearHeight, 0, 0);
                        }
                        SetResultsLabelText("ComponentHeight: " + CalcAZPlaceHeight(componentHeight).ToString());
                        kf.MoveSingleFeed(feedrate, placePosX, placePosY, CalcAZPlaceHeight(componentHeight), ClearHeight, 0, newrotation);
                        Thread.Sleep(100);
                        ChangeVacOutput(1, false);
                        Thread.Sleep(200);
                        kf.MoveSingleFeed(feedrate, placePosX, placePosY, ClearHeight, ClearHeight, 0, newrotation);

                    }
                    else
                    {
                        // use picker 2  CalcXwithNeedleSpacing
                        if (DefaultRotation != ComponentRotation)
                        {

                            newrotation = DefaultRotation + ComponentRotation;
                            if (ComponentRotation == 0)
                            {
                                newrotation = DefaultRotation;

                            }
                            kf.MoveSingleFeed(feedrate, CalcXwithNeedleSpacing(placePosX), placePosY, ClearHeight, ClearHeight, newrotation, 0);

                            kf.MoveSingleFeed(feedrate, CalcXwithNeedleSpacing(placePosX), placePosY, ClearHeight, CalcAZPlaceHeight(componentHeight), newrotation, 0);
                            // go down and turn off suction
                            Thread.Sleep(150);
                            ChangeVacOutput(2, false);
                            Thread.Sleep(50);
                            kf.MoveSingleFeed(feedrate, CalcXwithNeedleSpacing(placePosX), placePosY, ClearHeight, ClearHeight, newrotation, 0);
                        }
                        else
                        {
                            kf.MoveSingleFeed(feedrate, CalcXwithNeedleSpacing(placePosX), placePosY, ClearHeight, ClearHeight, 0, 0);
                            kf.MoveSingleFeed(feedrate, CalcXwithNeedleSpacing(placePosX), placePosY, ClearHeight, CalcAZPlaceHeight(componentHeight), 0, 0);
                            Thread.Sleep(150);
                            ChangeVacOutput(2, false);
                            Thread.Sleep(50);
                            kf.MoveSingleFeed(feedrate, CalcXwithNeedleSpacing(placePosX), placePosY, ClearHeight, ClearHeight, 0, 0);
                        }

                    }

                    currentrow++;
                    progresspert = currentrow * progresspertcalc;
                    worker.ReportProgress(Int32.Parse(progresspert.ToString()));
                }
                rundata.Dispose();

            }
            else
            {
                MessageBox.Show("Board file not loaded");
            }
            backgroundWorkerDoCommand.CancelAsync();

            worker.ReportProgress(100);
            // home all axis and zero
            SetResultsLabelText("Home and Reset");
            //kf.HomeAll();

            //Thread thrd = new Thread(new ThreadStart(DoHomeAll));
            //thrd.Start();
               // thrd.IsBackground = true;
        }