Exemplo n.º 1
0
 private void CheckModelType(string modelType)
 {
     ApprovalItemInfo condApprovalItem = new ApprovalItemInfo();
     condApprovalItem.Module = "FAI" + modelType;
     IList<ApprovalItemInfo> lstApprovalItem = iModelRepository.GetApprovalItem(condApprovalItem);
     if (null == lstApprovalItem || lstApprovalItem.Count == 0)
     {
         // 此Model類型:@ModelType未維護審核部門[ApprovalItem] ! 請先進行維護!
         throw new FisException("CQCHK1100", new string[] { modelType });
     }
 }
Exemplo n.º 2
0
 public void InsertApprovalItem(ApprovalItemInfo item)
 {
     string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
     logger.DebugFormat("BEGIN: {0}()", methodName);
     try
     {
         iModelRepository.InsertApprovalItem(item);
     }
     catch (FisException e)
     {
         logger.Error(e.mErrmsg, e);
         throw new Exception(e.mErrmsg);
     }
     catch (Exception e)
     {
         logger.Error(e.Message, e);
         throw;
     }
     finally
     {
         logger.DebugFormat("END: {0}()", methodName);
     }
 }
Exemplo n.º 3
0
    protected void btnSave_ServerClick(Object sender, EventArgs e)
    {
        string[] familyList = { };
        if (this.hidCheckFamilyList.Value != "")
        {
            familyList = this.hidCheckFamilyList.Value.Substring(0, this.hidCheckFamilyList.Value.Length - 1).Split(',');
        }
        
        string isneedupload = this.hidIsNeedUpload.Value;
        string familycount = this.hidFamilyListCount.Value;

        

        ApprovalItemInfo item = new ApprovalItemInfo();
        item.Module = this.cmbModule.SelectedValue;
        item.ActionName = this.cmbActionName.SelectedValue;
        item.Department = this.cmbDepartment.SelectedValue;
        item.IsNeedApprove = this.cmbIsNeedApproval.SelectedValue;
        item.OwnerEmail = this.txtOwnerEmail.Value.Trim();
        item.CCEmail = this.txtCCEmail.Value.Trim();
        item.IsNeedUploadFile = this.hidIsNeedUpload.Value;
        item.NoticeMsg = this.txtNoticeMsg.Value.Trim();
        item.Editor = this.HiddenUserName.Value;
        
        string id = this.hidID.Value;
        try
        {
            ApprovalItemInfo condition = new ApprovalItemInfo();
            condition.Module = item.Module;
            condition.ActionName = item.ActionName;
            IList<ApprovalItemInfo> approvalList = iModuleApprovalItem.GetModuleList(condition);
            condition.Department = item.Department;
            IList<SysSettingInfo> sysList = iSysSetting.GetSysSettingListByCondition(new SysSettingInfo { name = "OnlyNeedOQCApprove" });
            if (sysList.Count == 0 || sysList[0].value == "Y")
            {
                if(item.Department != "OQC")
                {
                    throw new FisException("只能選擇OQC部門!");
                }
            }
            IList<ApprovalItemInfo> checkLists = approvalList.Where(x => x.Department != "OQC" && x.IsNeedApprove=="Y").ToList();
//            if(item.IsNeedApprove == "N" && checkModule.Contains(item.Module) && checkActionName.Contains(item.ActionName))
            if (item.IsNeedApprove == "N" && item.Module.StartsWith("FAI") && checkActionName.Contains(item.ActionName))
            {
                if (checkLists.Count == 0)
                {
                    throw new FisException("請先維護須審核的部門 !");
                }
                if (checkLists.Count == 1 && checkLists[0].Department == item.Department)
                {
                    throw new FisException("請先維護須審核的部門 !");
                }
                
            }
            //if (item.IsNeedApprove == "N" && checkModule.Contains(item.Module) && checkActionName.Contains(item.ActionName))
            //{
            //    IList<ApprovalItemInfo> checkList = approvalList.Where(x => x.IsNeedApprove == "Y").ToList();
            //    if (checkList.Count <= 1)
            //    {
            //        throw new FisException("請先維護須審核的部門 !");
            //    }
            //}
            approvalList = approvalList.Where(x => x.Department == item.Department).ToList();
            if (string.IsNullOrEmpty(id))
            {
                if (approvalList.Count > 0)
                {
                    //throw new FisException("CQCHK50021", new string[] { condition.Module, condition.ActionName, condition.Department });
                    item.ID = approvalList[0].ID;
                    item.Udt = DateTime.Now;
                    iModuleApprovalItem.UpdateApprovalItem(item);
                }
                item.Cdt = DateTime.Now;
                item.Udt = DateTime.Now;
                iModuleApprovalItem.InsertApprovalItem(item);
            }
            else
            {
                if (approvalList.Count > 0 && approvalList[0].ID != Convert.ToInt32(id))
                {
                    //throw new FisException("CQCHK50021", new string[] { condition.Module, condition.ActionName, condition.Department });
                    showErrorMessage(string.Format("資料重複:Module[{0}],ActionName[{1}],Department[{2}]",condition.Module, condition.ActionName, condition.Department));
                    return;
                }
                item.ID = Convert.ToInt32(id);
                item.Udt = DateTime.Now;
                iModuleApprovalItem.UpdateApprovalItem(item);
            }
            approvalList = iModuleApprovalItem.GetModuleList(condition);
            iModuleApprovalItem.DeleteApprovalItemAttr(approvalList[0].ID);
            if (isneedupload == "Y")
            {
                InsertApprovalItemAttr(familyList, familycount,approvalList[0].ID);
            }
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            return;
        }
        catch (Exception ex)
        {
            showErrorMessage(ex.Message);
            return;
        }
        string itemId = item.ID.ToString();
        initcmbModuleTop(item.Module);
        getModuleList();
        this.updatePanel.Update();
        ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "AddUpdateComplete('" + itemId + "');DealHideWait();", true);
    }
Exemplo n.º 4
0
 public IList<ApprovalItemInfo> GetModuleList(ApprovalItemInfo condition)
 {
     string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
     logger.DebugFormat("BEGIN: {0}()", methodName);
     try
     {
         return iModelRepository.GetApprovalItem(condition);
     }
     catch (FisException e)
     {
         logger.Error(e.mErrmsg, e);
         throw new Exception(e.mErrmsg);
     }
     catch (Exception e)
     {
         logger.Error(e.Message, e);
         throw;
     }
     finally
     {
         logger.DebugFormat("END: {0}()", methodName);
     }
 }