protected void btnAdd_ServerClick(object sender, EventArgs e)
  {
      PartInfoMaintainInfo pinfoEnt = new PartInfoMaintainInfo();
      string infoValue = this.hidInfoValue.Value.Trim().ToUpper();
      string infoType = this.hidInfoType.Value.Trim();
      string pn = this.hidPartNo.Value.ToString();
      pinfoEnt.PartNo = pn;
      pinfoEnt.InfoType = infoType;
      pinfoEnt.InfoValue = infoValue;
      pinfoEnt.Editor = this.HiddenUsername.Value;
      pinfoEnt.Cdt = DateTime.Now;
      pinfoEnt.Udt = DateTime.Now;
      iPartEx.AddPartInfoForVendorCode(pinfoEnt);
 //     itemName = replaceSpecialChart(itemName);
      showListByPartNoAndType(pn, "");
      this.UpdatePanel1.Update();
  }
Beispiel #2
0
        public IList<PartInfoMaintainInfo> GetPartInfoListByPartNo(string partNo)
        {
            try
            {
                _Schema.SQLContext sqlCtx = new _Schema.SQLContext();
                IList<PartInfoMaintainInfo> ret = new List<PartInfoMaintainInfo>();
                //string pn, string bomNodeType, string type, string custpn, string descr, string remark, string autodl, string editor, DateTime cdt, DateTime udt, string descr2  
                string SQLStatement = @"select ID,PartNo,InfoType,InfoValue,Editor,Cdt,Udt from PartInfo with(NOLOCK) where PartNo=@PartNo
                                                            Union
                                                            (
                                                                 select '',@PartNo,Code,'','','','' from PartTypeAttribute with(NOLOCK) where PartType 
                                                                  in(  select PartType from Part where PartNo=@PartNo)
                                                                 and Code not in 
                                                                 (
                                                                  select InfoType from PartInfo with(NOLOCK) where PartNo=@PartNo
                                                                 ) 
                                                             );";

               
                sqlCtx.Params.Add("PartNo", new SqlParameter("@PartNo", SqlDbType.VarChar));
                sqlCtx.Params["PartNo"].Value = partNo;
                        
                using (DataTable dt = _Schema.SqlHelper.ExecuteDataFill(_Schema.SqlHelper.ConnectionString_GetData,
                                                                                                                             CommandType.Text, SQLStatement,
                                                                                                                             sqlCtx.Params.Values.ToArray<SqlParameter>()))
                {
                    string colName;
                    object value;
                    if (dt.Rows.Count > 0)
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            PartInfoMaintainInfo partInfo = new PartInfoMaintainInfo();
                                                
                                 foreach (FieldInfo f in partInfo.GetType().GetFields())
                                    {
                                        
                                         colName=f.Name;
                                         value=dr[colName];
                                         partInfo.GetType().GetField(colName).SetValue(partInfo, value);

                                    }

                            //

                                 ret.Add(partInfo);
                        }


                    }


                }
                return ret;
            }
            catch (Exception)
            {
                throw;
            }
        
        
        
        }
    protected void btnSave_ServerClick(object sender, EventArgs e)
    {
        PartInfoMaintainInfo pinfoEnt = new PartInfoMaintainInfo();
        string infoValue = this.hidInfoValue.Value.Trim();
        string infoType = this.hidInfoType.Value.Trim();
        string pn = this.hidPartNo.Value.ToString();
        string oldInfoValue = this.hidContent.Value.ToString();
        pinfoEnt.PartNo = pn;
        pinfoEnt.InfoType = infoType;
        pinfoEnt.InfoValue = infoValue;
        pinfoEnt.Editor = this.HiddenUsername.Value;
 
        pinfoEnt.Udt = DateTime.Now;
        if (hidCdt.Value == "" && hidUdt.Value == "")
        { iPartEx.AddPartInfoForVendorCode(pinfoEnt); }
        else
        { ipart.updatePartInfo(pinfoEnt, pn, infoType, oldInfoValue); }

        
     
         showListByPartNoAndType(pn, "");
          this.UpdatePanel1.Update();
          ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "setNewItemValue()", true);
        //添加partInfo数据
        //IList<PartInfoMaintainInfo> pinfo = new List<PartInfoMaintainInfo>();
        //PartInfoMaintainInfo pinfoEnt = new PartInfoMaintainInfo();
        //string dContent = this.txtInfoValue.Text;
        //string oldInfoValue = this.hidContent.Value.ToString();
        //string itemName = this.hidInfoValue.Value.ToString();
        //string pn = this.hidPartNo.Value.ToString();
        //pinfo = ipart.getLstPartInfo(pn, itemName, oldInfoValue);
        //if (pinfo != null && pinfo.Count > 0)
        //{
        //    pinfoEnt = pinfo.First();
        //}
        //if (dContent != "")
        //{
        //    pinfoEnt.PartNo = pn;
        //    pinfoEnt.InfoType = itemName;
        //    pinfoEnt.InfoValue = dContent;
        //    pinfoEnt.Editor = this.HiddenUsername.Value;
        //    pinfoEnt.Udt = DateTime.Now;
        //    try
        //    {
        //        if (oldInfoValue != "")
        //        {
        //            //修改数据
        //            ipart.updatePartInfo(pinfoEnt, pn, itemName, oldInfoValue);
        //        }
        //        else
        //        {
        //            //添加数据
        //            pinfoEnt.Cdt = DateTime.Now;
        //            ipart.addPartInfo(pinfoEnt);
        //        }
        //    }
        //    catch (FisException ex)
        //    {

        //        showErrorMessage(ex.mErrmsg);
        //        return;

        //    }
        //    catch (Exception ex)
        //    {
        //        showErrorMessage(ex.Message);
        //        return;
        //    }
        //    itemName = replaceSpecialChart(itemName);
        //    showListByPartNoAndType(pn, itemName);
        //    this.UpdatePanel1.Update();
        //    //ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "AddUpdateComplete('" + itemName + "');", true);
        //}
        //else
        //{
        //    //删除数据
        //    ipart.deletePartInfo(itemName);
        //    showListByPartNoAndType(pn, itemName);
        //    this.UpdatePanel1.Update();
        //    //ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "newIndex", "resetTableHeight();", true);
        //}




    }
    protected void btnSave_ServerClick(object sender, EventArgs e)
    {
        //添加partInfo数据
        IList<PartInfoMaintainInfo> pinfo = new List<PartInfoMaintainInfo>();
        PartInfoMaintainInfo pinfoEnt = new PartInfoMaintainInfo();
        string dContent = this.dItemName.Text;
        string oldInfoValue = this.hidContent.Value.ToString();
        string itemName = this.hidItemName.Value.ToString();
        string pn = this.hidPartNo.Value.ToString();
        pinfo = ipart.getLstPartInfo(pn, itemName, oldInfoValue);
        if (pinfo != null && pinfo.Count > 0)
        {
            pinfoEnt = pinfo.First();
        }
        if (dContent != "")
        {
            pinfoEnt.PartNo = pn;
            pinfoEnt.InfoType = itemName;
            pinfoEnt.InfoValue = dContent;
            pinfoEnt.Editor = this.HiddenUsername.Value;
            pinfoEnt.Udt = DateTime.Now;
            try
            {
                if (oldInfoValue != "")
                {
                    //修改数据
                    ipart.updatePartInfo(pinfoEnt, pn, itemName, oldInfoValue);
                }
                else
                {
                    //添加数据
                    pinfoEnt.Cdt = DateTime.Now;
                    ipart.addPartInfo(pinfoEnt);
                }
            }
            catch (FisException ex)
            {

                showErrorMessage(ex.mErrmsg);
                return;

            }
            catch (Exception ex)
            {
                showErrorMessage(ex.Message);
                return;
            }
            itemName = replaceSpecialChart(itemName);
            showListByPartNoAndType(pn, itemName);
            this.UpdatePanel1.Update();
            //ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "AddUpdateComplete('" + itemName + "');", true);
        }
        else
        {
            //删除数据
            ipart.deletePartInfo(itemName);
            showListByPartNoAndType(pn, itemName);
            this.UpdatePanel1.Update();
            //ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "newIndex", "resetTableHeight();", true);
        }




    }
Beispiel #5
0
 /// <summary>
 /// 修改partinfo数据
 /// </summary>
 /// <param name="obj"></param>
 /// <param name="partno"></param>
 public void updatePartInfo(PartInfoMaintainInfo obj, string partno, string infoType, string infoValue)
 {
     try
     {
         PartInfo pinfo = new PartInfo();
         pinfo.PN = obj.PartNo;
         pinfo.InfoValue = obj.InfoValue;
         pinfo.InfoType = obj.InfoType;
         pinfo.Editor = obj.Editor;
         pinfo.Cdt = obj.Cdt;
         pinfo.Udt = obj.Udt;
         partRepository.UpdatePartInfo(pinfo, partno, infoType, infoValue);
     }
     catch (FisException e)
     {
         logger.Error(e.mErrmsg);
         throw e;
     }
     catch (Exception e)
     {
         logger.Error(e.Message);
         throw;
     }
 }
Beispiel #6
0
 public IList<PartInfoMaintainInfo> getLstPartInfo(string partno, string infoType, string infoValue)
 {
     IList<PartInfoMaintainInfo> partList = new List<PartInfoMaintainInfo>();
     IList<PartInfo> pinfoLst = new List<PartInfo>();
     try
     {
         PartInfoMaintainInfo partInfo = new PartInfoMaintainInfo();
         pinfoLst = partRepository.GetLstPartInfo(partno, infoType, infoValue);
         if (partList.Count != 0)
         {
             foreach (PartInfo pf in pinfoLst)
             {
                 partInfo.PartNo = pf.PN;
                 partInfo.InfoType = pf.InfoType;
                 partInfo.InfoValue = pf.InfoValue;
                 partInfo.Editor = pf.Editor;
                 partInfo.Cdt = pf.Cdt;
                 partInfo.Udt = pf.Udt;
                 partList.Add(partInfo);
             }
             return partList;
         }
         else
         {
             return null;
         }
     }
     catch (FisException e)
     {
         logger.Error(e.mErrmsg);
         throw e;
     }
     catch (Exception e)
     {
         logger.Error(e.Message);
         throw;
     }
 }
Beispiel #7
0
        /// <summary>
        /// 写入PartInfo表一条数据
        /// </summary>
        /// <param name="obj"></param>
        public void addPartInfo(PartInfoMaintainInfo obj)
        {
            IList<PartInfo> lstPartTypePartInfo = new List<PartInfo>();
            try
            {
                lstPartTypePartInfo = partRepository.GetLstPartInfo(obj.PartNo, obj.InfoType, obj.InfoValue);
                if (lstPartTypePartInfo != null && lstPartTypePartInfo.Count > 0)
                {
                    //已经存在具有相同infovalue的记录
                    List<string> erpara = new List<string>();
                    FisException ex;
                    ex = new FisException("DMT098", erpara);
                    throw ex;
                }
                else
                {
                    PartInfo partInfo = new PartInfo();
                    partInfo.PN = obj.PartNo;
                    partInfo.InfoType = obj.InfoType;
                    partInfo.InfoValue = obj.InfoValue;
                    partInfo.Editor = obj.Editor;
                    partInfo.Cdt = obj.Cdt;
                    partInfo.Udt = obj.Udt;
                    partRepository.AddPartInfo(partInfo);
                }


            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw;
            }
        }
Beispiel #8
0
 public void AddPartInfoForVendorCode(PartInfoMaintainInfo obj)
 {
     IList<PartInfo> lstPartTypePartInfo = new List<PartInfo>();
     try
     {
             PartInfo partInfo = new PartInfo();
             partInfo.PN = obj.PartNo;
             partInfo.InfoType = obj.InfoType;
             partInfo.InfoValue = obj.InfoValue;
             partInfo.Editor = obj.Editor;
             partInfo.Cdt = obj.Cdt;
             partInfo.Udt = obj.Udt;
             partRepository.AddPartInfo(partInfo);
        
     }
     catch (FisException e)
     {
         logger.Error(e.mErrmsg);
         throw e;
     }
     catch (Exception e)
     {
         logger.Error(e.Message);
         throw;
     }
 }