Exemple #1
0
        void  showwrenchspecies(wrenchspecies wrenchspe)
        {
            if (wrenchspe == null)
            {
                return;
            }
            bool isfind = false;

            foreach (var s in cb_spparent.Items)
            {
                wrenchspecies wp = (wrenchspecies)s;
                if (wp != null && wp.guid != null)
                {
                    if (wp.guid == wrenchspe.parentSpecies)
                    {
                        cb_spparent.SelectedItem = wp;
                        isfind = true;
                        break;
                    }
                }
            }
            if (!isfind)
            {
                cb_spparent.SelectedIndex = -1;
            }
            this.tbox_spcode.Text = wrenchspe.speciesCode;
            this.tbox_spname.Text = wrenchspe.speciesName;
            //this.tbox_common .Text =wrenchspe .sp
        }
Exemple #2
0
 bool updata(wrenchspecies w)
 {
     try {
         return(WrenchSpecies.updata(w));
     }
     catch { return(false); }
 }
Exemple #3
0
 void clear()
 {
     this.tbox_spname.Clear();
     this.tbox_spcode.Clear();
     this.cb_spparent.SelectedIndex = -1;
     _ws   = null;
     isadd = true;
 }
Exemple #4
0
 bool  Add(wrenchspecies w)
 {
     try {
         w.guid = Guid.NewGuid().ToString();
         return(WrenchSpecies.add(w));
     }
     catch { return(false); }
 }
        private void Button_Click_13(object sender, RoutedEventArgs e)
        {
            wrenchspecies w = new wrenchspecies()
            {
                speciesName = "ww", speciesCode = "22", guid = Guid.NewGuid().ToString()
            };

            MessageBox.Show(WrenchSpecies.addreturnid(w).ToString());
        }
        private void Button_Click_17(object sender, RoutedEventArgs e)
        {
            wrenchspecies w = new wrenchspecies()
            {
                speciesName = this.content.Text.Trim(), speciesCode = "123", guid = "e8ad22ee-1f00-4b2a-94ee-a84d3b692f7d"
            };

            WrenchSpecies.updata(w);
        }
Exemple #7
0
 private void editButtonClick(object sender, RoutedEventArgs e)
 {
     if (this.dataGrid1.SelectedIndex < 0)
     {
         return;
     }
     _ws = dataGrid1.SelectedItem as wrenchspecies;
     showwrenchspecies(_ws);
     isadd = false;
 }
Exemple #8
0
        bool IsExit(wrenchspecies w)
        {
            List <wrenchspecies> wss = WrenchSpecies.selectbyname(this.tbox_spname.Text.Trim());

            if (wss != null && wss.Count > 0)
            {
                return(true);
            }
            return(false);
        }
Exemple #9
0
        bool IsUpdataRepeat(wrenchspecies w)
        {
            List <wrenchspecies> wss = WrenchSpecies.selectbyname(this.tbox_spname.Text.Trim());

            foreach (wrenchspecies ws in wss)
            {
                if (ws != null && ws.guid != w.guid)
                {
                    MessageAlert.Alert("该种类名称已经存在!");
                    return(true);
                }
            }
            return(false);
        }
Exemple #10
0
 private void button1_Click(object sender, RoutedEventArgs e)
 {
     if (IsEmpty())
     {
         return;
     }
     try {
         if (isadd)
         {
             wrenchspecies w = new wrenchspecies();
             w = getwrenchspecies(w);
             if (IsExit(w))
             {
                 return;
             }
             if (Add(w))
             {
                 MessageAlert.Alert("保存成功!");
             }
             else
             {
                 MessageAlert.Error("保存失败!");
                 return;
             }
         }
         else
         {
             wrenchspecies w = new wrenchspecies();
             w = _ws;
             w = getwrenchspecies(w);
             if (IsUpdataRepeat(w))
             {
                 return;
             }
             if (updata(w))
             {
                 MessageAlert.Alert("更新成功!");
             }
             else
             {
                 MessageAlert.Error("保存失败!");
                 return;
             }
         }
         getspecies();
         getparentspecies();
         clear();
     }
     catch { MessageAlert.Error("保存失败!"); }
 }
Exemple #11
0
 wrenchspecies  getwrenchspecies(wrenchspecies wrenchspcies)
 {
     wrenchspcies.speciesCode = tbox_spcode.Text.Trim();
     wrenchspcies.speciesName = tbox_spname.Text.Trim();
     if (cb_spparent.SelectedIndex > 0)
     {
         wrenchspcies.parentSpecies = cb_spparent.SelectedValue.ToString();
     }
     else
     {
         wrenchspcies.parentSpecies = "";
     }
     return(wrenchspcies);
 }
        private void Button_Click_8(object sender, RoutedEventArgs e)
        {
            List <wrenchspecies> wc = new List <wrenchspecies>();

            for (int i = 0; i < 4; i++)
            {
                wrenchspecies w = new wrenchspecies()
                {
                    speciesName = "ww", speciesCode = "22", guid = Guid.NewGuid().ToString()
                };
                wc.Add(w);
            }
            MessageBox.Show(WrenchSpecies.addmany(wc).ToString());
        }
        private List <ToolModel> Gettoolmodel(List <wrench> wrenchlist)
        {
            List <ToolModel> toolmodellist = new List <ToolModel>();

            try
            {
                if (wrenchlist != null && wrenchlist.Count > 0)
                {
                    int count = 0;

                    foreach (wrench w in wrenchlist)
                    {
                        count++;
                        wrenchspecies ws  = WrenchSpecies.selectByGuid(w.species);
                        wrenchstatus  wss = WrenchStatus.selectByguid(w.status);
                        toolmodellist.Add(new ToolModel()
                        {
                            comment       = w.comment,
                            createDate    = w.createDate,
                            factory       = w.factory,
                            guid          = w.guid,
                            id            = count,
                            IP            = w.IP,
                            port          = w.port,
                            rangeMax      = Convert.ToDecimal(w.rangeMax.ToString("f1")),
                            rangeMin      = Convert.ToDecimal(w.rangeMin.ToString("f1")),
                            targetvalue   = Convert.ToDecimal(w.targetvalue.ToString("f1")),
                            targetvalue1  = Convert.ToDecimal(w.targetvalue1.ToString("f1")),
                            targetvalue2  = Convert.ToDecimal(w.targetvalue2.ToString("f1")),
                            unit          = w.unit,
                            species       = w.species,
                            speciesName   = ws.speciesName,
                            status        = w.status,
                            statusDM      = wss.statusDM,
                            statusName    = wss.statusName,
                            lastrepair    = w.lastrepair,
                            cycletime     = Convert.ToDecimal(w.cycletime.ToString("f0")),
                            wrenchBarCode = w.wrenchBarCode,
                            wrenchCode    = w.wrenchCode
                        });
                    }
                }
                else
                {
                    MessageAlert.Alert("没有工具信息!");
                }
            }
            catch { }
            return(toolmodellist);
        }
Exemple #14
0
        ToolModel GetToolModel(wrench w)
        {
            wrenchspecies ws = WrenchSpecies.selectByGuid(w.species);

            return(new ToolModel()
            {
                wrenchBarCode = w.wrenchBarCode,
                wrenchCode = w.wrenchCode,
                speciesName = ws.speciesName,
                lastrepair = w.lastrepair,
                cycletime = Convert.ToDecimal(w.cycletime.ToString("f0")),
                isallowcheck = w.isallowcheck,
                guid = w.guid
            });
        }
Exemple #15
0
        public wrenchinfo GetWrenchinfo(string barcode)
        {
            wrench w = Wrench.selectByBarcode(barcode);

            if (w == null)
            {
                return(null);
            }
            wrenchspecies ws  = WrenchSpecies.selectByGuid(w.species);
            wrenchstatus  wss = WrenchStatus.selectByguid(w.status);
            wrenchinfo    wi  = new wrenchinfo();

            wi.wrench  = w;
            wi.species = ws;
            wi.status  = wss;
            return(wi);
        }
        private List <ToolModel> Gettoolmodel(List <wrench> wrenchlist)
        {
            List <ToolModel> toolmodellist = new List <ToolModel>();

            try
            {
                if (wrenchlist != null)
                {
                    int tempid = 1;
                    foreach (wrench w in wrenchlist)
                    {
                        wrenchspecies ws  = WrenchSpecies.selectByGuid(w.species);
                        wrenchstatus  wss = WrenchStatus.selectByguid(w.status);
                        toolmodellist.Add(new ToolModel()
                        {
                            comment       = w.comment,
                            createDate    = w.createDate,
                            factory       = w.factory,
                            guid          = w.guid,
                            id            = tempid++,
                            IP            = w.IP,
                            port          = w.port,
                            rangeMax      = Convert.ToDecimal(w.rangeMax.ToString("f1")),
                            rangeMin      = Convert.ToDecimal(w.rangeMin.ToString("f1")),
                            targetvalue   = Convert.ToDecimal(w.targetvalue.ToString("f1")),
                            targetvalue1  = Convert.ToDecimal(w.targetvalue1.ToString("f1")),
                            targetvalue2  = Convert.ToDecimal(w.targetvalue2.ToString("f1")),
                            offPset       = w.offPset,
                            unit          = w.unit,
                            species       = w.species,
                            speciesName   = ws != null ? ws.speciesName : "",
                            status        = w.status,
                            statusDM      = wss != null ? wss.statusDM : "",
                            statusName    = wss != null ? wss.statusName : "",
                            wrenchBarCode = w.wrenchBarCode,
                            wrenchCode    = w.wrenchCode,
                            lastrepair    = w.lastrepair
                        });
                    }
                }
            }
            catch
            { }
            return(toolmodellist);
        }
Exemple #17
0
 private void delButtonClick(object sender, RoutedEventArgs e)
 {
     if (this.dataGrid1.SelectedIndex >= 0)
     {
         wrenchspecies wp = this.dataGrid1.SelectedItem as wrenchspecies;
         if (wp != null)
         {
             if (WrenchSpecies.Del(wp))
             {
                 MessageAlert.Alert("记录删除成功!");
             }
             else
             {
                 MessageAlert.Alert("该条记录不能删除!");
             }
         }
         getspecies();
     }
 }
Exemple #18
0
        public bool Del(wrenchspecies wrenchspecies)
        {
            string contion = string.Format("id='{0}'", wrenchspecies.id);

            return(ServerHelp.deleteDataByWhere <wrenchspecies>(_webip, contion));
        }
Exemple #19
0
 public string addreturnid(wrenchspecies species)
 {
     return(ServerHelp.addSingleInfoReturnID <wrenchspecies>(species, _webip).ToString());
 }
Exemple #20
0
 public bool add(wrenchspecies species)
 {
     return(ServerHelp.addSingleInfoNotReturnID <wrenchspecies>(species, _webip));
 }