Exemple #1
0
 public void SetGt(ICollection<PS_gt> gts) {
     gtlist = new List<itemobj>();
     foreach (PS_gt gt in gts) {
         itemobj obj =new itemobj(gt);
         comboBoxEdit10.Properties.Items.Add(obj);
         comboBoxEdit11.Properties.Items.Add(obj);
         gtlist.Add(obj);
     }
     RowData = new PS_gtsb();
     rowData.sbNumber = 1;
 }
Exemple #2
0
        private void save() {
            int begin = comboBoxEdit10.SelectedIndex;
            int end = comboBoxEdit11.SelectedIndex;
            //int bh =1;
            if (string.IsNullOrEmpty(comboBoxEdit2.Text)) {
                MsgBox.ShowTipMessageBox("请选择设备种类");
                comboBoxEdit2.Focus();
                return;
            }
            //if (string.IsNullOrEmpty(comboBoxEdit3.Text)) {
            //    MsgBox.ShowTipMessageBox("请选择设备型号");
            //    comboBoxEdit3.Focus();
            //    return;
            //}
            //if (!int.TryParse(comboBoxEdit1.Text, out bh)) {
            //    bh = 1;
            //}
            //if (bh<0||bh > 999) {
            //    MsgBox.ShowTipMessageBox("编号范围000-999");
            //    return;
            //}
            //if ((bh + end - begin) > 999) {
            //    MsgBox.ShowTipMessageBox("终止编号不能大于999");
            //    return;
            //}
            List<PS_gtsb> gtsblist = new List<PS_gtsb>();

            //for (int i = begin; i <= end; i++) {

            //    PS_gt gt= gtlist[i].Gt;
            //    PS_gtsb gtsb = new PS_gtsb();
            //    Ebada.Core.ConvertHelper.CopyTo(RowData,gtsb);
            //    gtsb.gtID = gt.gtID;
            //    gtsb.sbID =gt.CreateID()+i;
            //    gtsb.sbCode = bh.ToString("000");
            //    gtsblist.Add(gtsb);
            //}
            DataTable dt = gridControl1.DataSource as DataTable;
            if (dt != null && dt.Rows.Count > 0)
            {
                for (int i = begin; i <= end; i++)
                {

                    PS_gt gt = gtlist[i].Gt;
                    int j = 0;
                    foreach (DataRow dr in dt.Rows)
                    {
                        if (dr["type"] == null) continue;
                        PS_gtsb gtsb = new PS_gtsb();

                        gtsb.sbName = dr["name"].ToString();
                        gtsb.sbModle = dr["sbgg"].ToString();
                        if (dr["sl"] != null && (dr["sl"].ToString().Trim())!="") 
                            gtsb.sbNumber = Convert.ToInt16( dr["sl"]);
                        gtsb.sbID = gtsb.CreateID();
                        gtsb.gtID = gt.gtID;
                        gtsb.sbID = gt.CreateID() + i;
                        j++;
                        gtsb.sbCode = j.ToString("000");
                        gtsb.sbType = dr["type"].ToString();
                        if (gtsb.sbName == "") continue;
                        Thread.Sleep(new TimeSpan(100000));//0.1毫秒
                        gtsblist.Add(gtsb);
                    }
                }
            }
            Ebada.Client.ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(gtsblist, null, null);
        }
Exemple #3
0
        private void save2() {
            string sql = string.Format("select gtid from ps_gt where linecode in (select linecode from ps_xl where linevol='0.4' and linecode like '{0}%')", mpstq.tqCode);

            IList list = ClientHelper.PlatformSqlMap.GetList("SelectOneStr", sql);
            if (list.Count <2) return;
            DataTable dt = gridControl1.DataSource as DataTable;
            List<PS_gtsb> gtsblist = new List<PS_gtsb>();
            if (dt != null && dt.Rows.Count > 0) {
                for (int i = 0; i < list.Count; i++) {

                    string gtid = list[i].ToString();
                    int j = 0;
                    foreach (DataRow dr in dt.Rows) {
                        if (dr["type"] == null) continue;
                        PS_gtsb gtsb = new PS_gtsb();

                        gtsb.sbName = dr["name"].ToString();
                        gtsb.sbModle = dr["sbgg"].ToString();
                        if (dr["sl"] != null && (dr["sl"].ToString().Trim()) != "")
                            gtsb.sbNumber = Convert.ToInt16(dr["sl"]);
                        gtsb.gtID = gtid;
                        gtsb.sbID = gtsb.CreateID() + j;
                        j++;
                        gtsb.sbCode = j.ToString("000");
                        gtsb.sbType = dr["type"].ToString();
                        if (gtsb.sbName == "") continue;
                        Thread.Sleep(new TimeSpan(100000));//0.1毫秒
                        gtsblist.Add(gtsb);
                    }
                }
            }
            if (gtsblist.Count > 0) {
                Ebada.Client.ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(gtsblist, null, null);
                MsgBox.ShowTipMessageBox(string.Format("共插入{0}条记录", gtsblist.Count));
            }

        }
Exemple #4
0
        public string UpdateGtOne(ps_gt data) {
            PS_gt gt = Ebada.Client.ClientHelper.PlatformSqlMap.GetOneByKey<PS_gt>(data.gtID);
            if (gt != null) {
                //foreach(FieldInfo fi in data.GetType().GetFields()){
                //    try {
                //        gt.GetType().GetProperty(fi.Name).SetValue(gt, fi.GetValue(data), null);
                //    } catch { }
                //}
                gt.gtType = data.gtType;
                gt.gtModle = data.gtModle;
                gt.gtElev = (int)decimal.Parse(data.gtElev);
                gt.gtLat = decimal.Parse(data.gtLat);
                gt.gtLon = decimal.Parse(data.gtLon);
                gt.gtHeight = decimal.Parse(data.gtHeight);
                gt.gtJg = data.gtSpan == "是" ? "是" : "否";//借杆
                if ((gt.gtLat + gt.gtLon) > 0) {
                    int n = Ebada.Client.ClientHelper.PlatformSqlMap.Update<PS_gt>(gt);
                    ncount += n;
                }
                if (data.jsonData != null) {
                    Console.WriteLine(data.jsonData);
                    List<ps_gtsb> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ps_gtsb>>(data.jsonData);
                    if (list != null) {
                        List<SqlQueryObject> sqllist = new List<SqlQueryObject>();
                        SqlQueryObject sqo = new SqlQueryObject(SqlQueryType.Delete, "Delete", "delete from ps_gtsb where gtid='" + gt.gtID + "'");
                        sqllist.Add(sqo);
                        int num = 0;
                        foreach (ps_gtsb sb in list) {
                            num++;
                            PS_gtsb gtsb = new PS_gtsb() { gtID = gt.gtID, sbModle = sb.xh, sbType = sb.zldm, sbNumber = short.Parse(sb.sl), sbName = sb.zl, sbCode = num.ToString("000") };
                            gtsb.sbID = gt.gtID + num.ToString("000");
                            sqo = new SqlQueryObject(SqlQueryType.Insert, gtsb);
                            sqllist.Add(sqo);
                        }
                        Client.ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(sqllist);
                    }
                    //Console.WriteLine(list != null ? list.Count : 0);
                }
                //Console.WriteLine("update {0} count {1}", gt.gtCode, n);
            }

            return "";
        }
Exemple #5
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) {
            UCPS_gtsbclbMain ucTop = new UCPS_gtsbclbMain();
            ucTop.InitColumns();
            ucTop.InitData();
            ucTop.hidbarmange();
            FormBase dlg = showControl(ucTop);
            if (dlg.DialogResult == DialogResult.OK) {
                PS_gtsbclb obj = ucTop.SelectObject();
                if (obj != null) {
                    // List<PS_gtsb> listsb=new List<PS_gtsb>();
                    IList<PS_gtsbclb> list = Client.ClientHelper.PlatformSqlMap.GetList<PS_gtsbclb>("where ParentID='" + obj.ID + "'order by xh");
                    int i = 0;
                    foreach (PS_gtsbclb pl in list) {
                        i++;
                        PS_gtsb pt = Client.ClientHelper.PlatformSqlMap.GetOne<PS_gtsb>("where gtid='" + parentID + "'and sbid='" + pl.ID + "'");
                        if (pt == null) {
                            pt = new PS_gtsb();
                            pt.gtID = parentID;
                            //pt.sbNumber = Convert.ToInt16(pl.sl);
                            // pt.sbCode = pl.xh;
                            pt.sbID = pl.ID;
                            pt.sbModle = pl.xh;
                            pt.sbName = pl.mc;
                            pt.sbType = obj.zl;
                            pt.C1 = pl.S1;
                            Client.ClientHelper.PlatformSqlMap.Create<PS_gtsb>(pt);
                        } else {
                            pt.gtID = parentID;
                            // pt.sbNumber = Convert.ToInt16(pl.sl);
                            // pt.sbCode = getcode() + i;
                            pt.sbID = pl.ID;
                            pt.sbModle = pl.xh;
                            pt.sbName = pl.mc;
                            pt.sbType = obj.zl;
                            pt.C1 = pl.S1;
                            Client.ClientHelper.PlatformSqlMap.Update<PS_gtsb>(pt);
                        }

                        //listsb.Add(pt);
                    }
                    //Client.ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(listsb,null,null);
                }
            }
            RefreshData(" where gtID='" + parentID + "' order by sbCode");
        }
Exemple #6
0
 /// <summary>
 /// 新建对象设置Key值
 /// </summary>
 /// <param name="newobj"></param>
 void gridViewOperation_CreatingObjectEvent(PS_gtsb newobj) {
     if (parentID == null) return;
     newobj.gtID = parentID;
     newobj.sbNumber = 1;
     newobj.sbType = "17001";
     newobj.sbName = "表箱";
     newobj.sbCode = (gridView1.RowCount+1).ToString("000");
 }
Exemple #7
0
      /// <summary>
      /// 新建对象设置Key值
      /// </summary>
      /// <param name="newobj"></param>
      void gridViewOperation_CreatingObjectEvent(PS_gtsb newobj)
      {
          if (parentID == null) return;
          newobj.gtID = parentID;
          newobj.sbCode = getCode();
 
      }