示例#1
0
    protected void Save_ServerClick(Object sender, EventArgs e)
    {
        string msgHasExistRecord = GetLocalResourceObject(Pre + "_msgHasExistRecord").ToString();

        try
        {
            PCBVersionInfo PCBVersionInfo = new PCBVersionInfo();
            PCBVersionInfo.Family = this.hidFamily2.Value;
            PCBVersionInfo.MBCode = this.txtMBCode.Value.Trim();
            PCBVersionInfo.PCBVer = this.txtPCB.Value.Trim();
            PCBVersionInfo.CTVer  = this.txtCTVer.Value.Trim();
            PCBVersionInfo.Supplier = this.txtSupplier.Value.Trim();
            PCBVersionInfo.Remark = this.ttRemark.Value.Trim();
            PCBVersionInfo.Editor = UserId.ToString();
            string oldFamily = this.CmbMaintainFamilyForECRVersion2.InnerDropDownList.SelectedValue;//this.hidFamily.Value;
      

            gFamily = this.hidFamily2.Value;
            gMbCode = this.txtMBCode.Value.Trim();
            gPCB = this.txtPCB.Value.Trim();

            iPCBVersion.SavePCBVersion(PCBVersionInfo);

            this.CmbMaintainFamilyForECRVersion.refresh();
            this.CmbMaintainFamilyForECRVersion.InnerDropDownList.SelectedValue = oldFamily;
            IList<PCBVersionInfo> lstPCBVersionInfo = iPCBVersion.GetPCBVersionInfoListByFamily(oldFamily);
            bindTable(lstPCBVersionInfo, DEFAULT_ROWS);
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            return;
            bindTable(null, DEFAULT_ROWS);
        }
        catch (Exception ex)
        {
            showErrorMessage(ex.Message);
            return;
            bindTable(null, DEFAULT_ROWS);
            //this.hidRecordCount.Value = "0";
        }
        finally
        {
            ScriptManager.RegisterStartupScript(this.Page, typeof(System.Object), "resetTableHeight", "resetTableHeight();", true);
            hideWait();
        }
    }
示例#2
0
    protected void Delete_ServerClick(Object sender, EventArgs e)
    {
        try
        {
            IList<PCBVersionInfo> lstPCBVersionInfo = null;
            PCBVersionInfo deleteItem = new PCBVersionInfo();
            deleteItem.Family=this.hidFamily2.Value;
            deleteItem.MBCode = this.hidDeleteMBCode.Value.Trim();
            deleteItem.PCBVer = this.hidDeletePCB.Value.Trim();
            string oldFamily = this.hidFamily2.Value;

            iPCBVersion.DeletePCBVersion(deleteItem);
            
            this.CmbMaintainFamilyForECRVersion.refresh();
            this.CmbMaintainFamilyForECRVersion.InnerDropDownList.SelectedValue = oldFamily;
            lstPCBVersionInfo = iPCBVersion.GetPCBVersionInfoListByFamily(oldFamily);
            bindTable(lstPCBVersionInfo, DEFAULT_ROWS);
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            bindTable(null, DEFAULT_ROWS);
        }
        catch (Exception ex)
        {
            showErrorMessage(ex.Message);
            bindTable(null, DEFAULT_ROWS);
        }
        finally
        {
            hideWait();
        }
    }
示例#3
0
        public void SavePCBVersion(PCBVersionInfo info)
        {
            logger.Debug("(PCBVersionManager)SavePCBVersion start, [info]:" + info);
            IUnitOfWork work = new UnitOfWork();
            IList<PCBVersion> lstPCBVersion = null;

            try
            {
                lstPCBVersion = ier.GetPCBVersion(info.Family, info.MBCode);

                if (lstPCBVersion == null || lstPCBVersion.Count == 0)
                {
                    ier.Add(GetPCBVersion(info), work);
                }
                else
                {

                    var q =
                        (from p in lstPCBVersion
                        where p.PCBVer == info.PCBVer
                        select p).Count();

                    
                    if (q == 0)
                    {
                        ConvertPCBVersionInfoTOPCBVersion(lstPCBVersion[0], info);
                        ier.Add(lstPCBVersion[0], work);
                        
                    }
                    else if (q > 0)
                    {
                        foreach (PCBVersion items in lstPCBVersion)
                        {
                            if (items.PCBVer == info.PCBVer)
                            { 
                                ConvertPCBVersionInfoTOPCBVersion(items, info);
                                ier.Update(items, work);
                            }
                        }
                    }
                    else
                    {
                        List<string> param = new List<string>();
                        throw new FisException("DMT137", param);
                    }

                    //if (lstPCBVersion[0].PCBVer == info.PCBVer)
                    //{
                    //    ConvertPCBVersionInfoTOPCBVersion(lstPCBVersion[0], info);
                    //    ier.Update(lstPCBVersion[0], work);
                    //}
                    //else
                    //{
                    //    List<string> param = new List<string>();

                    //    throw new FisException("DMT137", param);
                    //}
                }

                work.Commit();
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw;
            }
            finally
            {
                logger.Debug("(PCBVersionManager)SavePCBVersion end, [info]:" + info);
            }            
        }
示例#4
0
 private void ConvertPCBVersionInfoTOPCBVersion(PCBVersion e, PCBVersionInfo info)
 {
     e.Family = info.Family;
     e.MBCode = info.MBCode;
     e.PCBVer = info.PCBVer;
     e.CTVer = info.CTVer;
     e.Supplier = info.Supplier;
     e.Remark = info.Remark;
     e.Editor = info.Editor;
 }
示例#5
0
 private PCBVersion GetPCBVersion(PCBVersionInfo info)
 {
     PCBVersion e = new PCBVersion();
     e.Family = info.Family;
     e.MBCode = info.MBCode;
     e.PCBVer = info.PCBVer;
     e.CTVer = info.CTVer;
     e.Supplier = info.Supplier;
     e.Remark = info.Remark;
     e.Editor = info.Editor;
     return e;
 }
示例#6
0
 private PCBVersionInfo GetPCBVersionInfo(PCBVersion version)
 {
     PCBVersionInfo e = new PCBVersionInfo();
     e.Family = version.Family;
     e.MBCode = version.MBCode;
     e.PCBVer = version.PCBVer;
     e.CTVer = version.CTVer;
     e.Supplier = version.Supplier;
     e.Remark = version.Remark;
     e.Editor = version.Editor;
     e.Cdt = version.Cdt;
     e.Udt = version.Udt;
     return e;
 }
示例#7
0
 public void DeletePCBVersion(PCBVersionInfo info)
 {
     logger.Debug("(PCBVersionManager)DeletePCBVersion start, [info]:" + info);
     IList<PCBVersion> lstPCBVersion = null;
     IUnitOfWork work = new UnitOfWork();
     try
     {
         lstPCBVersion = ier.GetPCBVersion(info.Family, info.MBCode);
         if (lstPCBVersion != null || lstPCBVersion.Count != 0)
         {
             ier.Remove(GetPCBVersion(info),work);
         }
         work.Commit();
     }
     catch (FisException e)
     {
         logger.Error(e.mErrmsg);
         throw e;
     }
     catch (Exception e)
     {
         logger.Error(e.Message);
         throw;
     }
     finally
     {
         logger.Debug("(PCBVersionManager)DeletePCBVersion end, [info]:" + info);
     } 
 }