コード例 #1
0
 /// <summary>
 /// Set import data to screen
 /// </summary>
 /// <param name="import"></param>
 /// <param name="key"></param>
 private void CTS061_SetImportData(CTS061_ScreenParameter import, string key = null)
 {
     try
     {
         UpdateScreenObject(import, key);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #2
0
        public ActionResult CTS061()
        {
            ObjectResultData res = new ObjectResultData();

            try
            {
                CTS061_ScreenParameter session = GetScreenObject <CTS061_ScreenParameter>();
                ViewBag.ContractCode = session.ScreenParameter.contractCode;
                InitialScreen_CTS061(ViewBag.ContractCode);
                return(View("CTS061"));
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }
コード例 #3
0
        //BackClick perform in javascript

        #endregion

        #region Method

        /// <summary>
        /// Check system suspending, user’s permission and user’s authority of screen
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public ActionResult CTS061_Authority(CTS061_ScreenParameter param)
        {
            ObjectResultData res = new ObjectResultData();

            try
            {
                CommonUtil           util          = new CommonUtil();
                ICommonHandler       commonHandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                ISaleContractHandler saleHandler   = ServiceContainer.GetService <ISaleContractHandler>() as ISaleContractHandler;

                //1.1 Check suspending
                if (commonHandler.IsSystemSuspending())
                {
                    res.AddErrorMessage("Common", MessageUtil.MessageList.MSG0049, new string[] { String.Format("Contract Code: {0}", param.ContractCode) }, null);
                    return(Json(res));
                }

                //1.2 Check user's permission
                if (!CheckUserPermission(ScreenID.C_SCREEN_ID_CQ12_CHANGE_COMPLETE_INSTALLATION_DATE, FunctionID.C_FUNC_ID_OPERATE))
                {
                    res.AddErrorMessage("Common", MessageUtil.MessageList.MSG0053, null, null);
                    return(Json(res));
                }

                // Check parameter
                if ((param == null) ||
                    (String.IsNullOrEmpty(param.ContractCode)))
                {
                    //if (String.IsNullOrEmpty(CommonUtil.dsTransData.dtCommonSearch.ContractCode))
                    //{
                    //    // Not valid
                    //    //res.AddErrorMessage("Common", MessageUtil.MessageList.MSG0011, new string[] { "Contract Code" }, null);
                    //    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0147, null, null);
                    //    return Json(res);
                    //}
                    //else
                    //{
                    //    param.ContractCode = CommonUtil.dsTransData.dtCommonSearch.ContractCode;
                    //}

                    if (param.CommonSearch != null)
                    {
                        if (CommonUtil.IsNullOrEmpty(param.CommonSearch.ContractCode) == false)
                        {
                            param.ContractCode = param.CommonSearch.ContractCode;
                        }
                    }
                    if (String.IsNullOrEmpty(param.ContractCode))
                    {
                        res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0147, null, null);
                        return(Json(res));
                    }
                }

                // Check is contact exists
                var contractObj = saleHandler.GetTbt_SaleBasic(util.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG), null, true);
                if ((contractObj == null) ||
                    (contractObj.Count == 0))
                {
                    // Not found
                    //res.AddErrorMessage("Common", MessageUtil.MessageList.MSG0011, new string[] { String.Format("Contract Code: {0}", param.ContractCode) }, null);
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0124, null, null);
                    return(Json(res));
                }

                string lastOCC        = saleHandler.GetLastOCC(contractObj[0].ContractCode);
                var    dsSaleContract = saleHandler.GetEntireContract(contractObj[0].ContractCode, lastOCC);

                if ((dsSaleContract != null) &&
                    (dsSaleContract.dtTbt_SaleBasic != null) &&
                    (dsSaleContract.dtTbt_SaleBasic.Count != 0))
                {
                    /*
                     * if (CommonUtil.dsTransData.dtOfficeData.FindAll(delegate(OfficeDataDo s) { return s.OfficeCode == dsSaleContract.dtTbt_SaleBasic[0].ContractOfficeCode; }).Count == 0)
                     * {
                     *  res.AddErrorMessage("Common", MessageUtil.MessageList.MSG0063, null, null);
                     *  return Json(res);
                     * }
                     *
                     * if (CommonUtil.dsTransData.dtOfficeData.FindAll(delegate(OfficeDataDo s) { return s.OfficeCode == dsSaleContract.dtTbt_SaleBasic[0].OperationOfficeCode; }).Count == 0)
                     * {
                     *  res.AddErrorMessage("Common", MessageUtil.MessageList.MSG0063, null, null);
                     *  return Json(res);
                     * }*/

                    var existsContarctOffice = CommonUtil.dsTransData.dtOfficeData.Where(x => x.OfficeCode == dsSaleContract.dtTbt_SaleBasic[0].ContractOfficeCode);
                    var existsOperateOffice  = CommonUtil.dsTransData.dtOfficeData.Where(x => x.OfficeCode == dsSaleContract.dtTbt_SaleBasic[0].OperationOfficeCode);

                    if ((existsContarctOffice.Count() <= 0) && (existsOperateOffice.Count() <= 0))
                    {
                        res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0063, null, null);
                        res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                        return(Json(res));
                    }

                    if (dsSaleContract.dtTbt_SaleBasic[0].InstallationCompleteFlag == FlagType.C_FLAG_ON)
                    {
                        res.AddErrorMessage("Contract", MessageUtil.MessageList.MSG3058, null, null);
                        return(Json(res));
                    }
                }
                else
                {
                    res.AddErrorMessage("Common", MessageUtil.MessageList.MSG0011, new string[] { String.Format("Contract Code: {0}", param.ContractCode) }, null);
                    return(Json(res));
                }

                param.ScreenParameter = new CTS061_Parameter()
                {
                    contractCode = util.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG)
                };
                param.ContractCode = param.ScreenParameter.contractCode;

                return(InitialScreenEnvironment <CTS061_ScreenParameter>("CTS061", param, res));
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }