public override object Do(object obj)
        {
            RedFlushPrePaymentBP bpObj = (RedFlushPrePaymentBP)obj;

            if (bpObj == null)
            {
                return(false);
            }

            List <CommonDTO> resultList = new List <CommonDTO>();

            using (ISession session = Session.Open())
            {
                foreach (PrePaymentHeadDTO headDto in bpObj.PrePaymentHeadDTOs)
                {
                    UFIDA.U9.Cust.GS.FI.PrePaymentBE.PrePayment doc = UFIDA.U9.Cust.GS.FI.PrePaymentBE.PrePayment.Finder.FindByID(headDto.SrcPrePayDocID);
                    if (doc != null)
                    {
                        CommonDTO result = new CommonDTO();
                        result.ID = CreatePrePayment(doc, headDto);

                        resultList.Add(result);
                    }
                }
                session.Commit();
            }

            return(resultList);
        }
        public override object Do(object obj)
        {
            CreateDeductionRegisterBP bpObj = (CreateDeductionRegisterBP)obj;

            if (bpObj == null)
            {
                return(null);
            }

            //创建扣款登记
            List <CommonDTO> resultList = new List <CommonDTO>();

            using (ISession session = Session.Open())
            {
                foreach (DeductionRegisterDTO dto in bpObj.DeductionRegisterDTOs)
                {
                    DeductionRegisterDocType docType = dto.DocumentType.GetEntity();
                    if (docType == null)
                    {
                        docType = DeductionRegisterDocType.Finder.Find("IsCreatedByPush");
                    }
                    if (docType == null)
                    {
                        throw new Exception("没有设定单据类型!");
                    }

                    CommonDTO result = new CommonDTO();//返回对象

                    DeductionRegister doc = DeductionRegister.Create();
                    #region 实体字段赋值
                    doc.DocumentTypeKey = docType.Key;
                    doc.SrcDocType      = DRSrcDocTypeEnum.GetFromValue(dto.SrcDocType);
                    doc.SrcOrgKey       = dto.SrcOrg;
                    doc.SrcDocNo        = dto.SrcDocNo;
                    doc.SrcDocID        = dto.SrcDocID;
                    doc.CurrencyKey     = dto.Currency;
                    doc.DRObject        = DRObjectEnum.GetFromValue(dto.DRObject);
                    doc.CustomerKey     = dto.Customer;
                    doc.SupplierKey     = dto.Supplier;
                    doc.DROrgKey        = dto.DROrg;
                    doc.DRMoney         = dto.DRMoney;
                    doc.DRReason        = DRReasonEnum.GetFromValue(dto.DRReason);
                    doc.DRAssess        = dto.DRAssess;
                    doc.RegisterOrgKey  = dto.RegisterOrg;
                    doc.RegisterDeptKey = dto.RegisterDept;
                    doc.RegisterBy      = dto.RegisterBy;
                    doc.RegisterDate    = dto.RegisterDate;
                    doc.BuyerKey        = dto.Buyer;
                    doc.Meno            = dto.Meno;
                    doc.BusinessDate    = DateTime.Now;
                    #endregion
                    result.ID = doc.ID;
                    resultList.Add(result);
                }
                session.Commit();
            }

            return(resultList);
        }
Esempio n. 3
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            LoginUserDetails objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails);

            try
            {
                int         RedirectionType;
                object      path             = null;
                string      sController      = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName;
                string      sAction          = filterContext.ActionDescriptor.ActionName;
                string      ControllerAction = sController + sAction;
                int         ValidationType   = ConstEnum.ValidateTo[ControllerAction];
                int         LoggenInUserId   = objLoginUserDetails.LoggedInUserID;
                CommonDAL   objCommonDAL     = new CommonDAL();
                CommonModel objCommonModel   = new CommonModel();
                CommonDTO   objCommonDTO     = new CommonDTO();
                objCommonDTO = objCommonDAL.InitialChecks(objLoginUserDetails.CompanyDBConnectionString, ValidationType, LoggenInUserId, out RedirectionType);
                if (RedirectionType != 0)
                {
                    path = ConstEnum.Redirect[RedirectionType];
                    var sType  = path.GetType();
                    var values = new System.Web.Routing.RouteValueDictionary();
                    foreach (var prop in sType.GetProperties(BindingFlags.Public | BindingFlags.Instance))
                    {
                        values.Add(prop.Name, Convert.ToString(prop.GetValue(path, null)));
                    }
                    if (objCommonDTO != null)
                    {
                        var sourceType = objCommonDTO.GetType();
                        foreach (var property in sourceType.GetProperties(BindingFlags.Public | BindingFlags.Instance))
                        {
                            if (Convert.ToString(property.GetValue(objCommonDTO, null)) != null && Convert.ToString(property.GetValue(objCommonDTO, null)) != "")
                            {
                                values.Add(property.Name, Convert.ToString(property.GetValue(objCommonDTO, null)));
                            }
                        }
                    }
                    filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(values));
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
Esempio n. 4
0
        // GET: Liveboard
        public ActionResult Index()
        {
            //get current account logged
            ZEMP_USER account = Session[CommonHeader.ssAccount] as ZEMP_USER;

            if (account == null)
            {
                return(RedirectToAction(CommonHeader.mtdAccountIndex, CommonHeader.ctlAccount));
            }
            CommonDTO cm = new CommonDTO();

            //Get codition from current account logged
            FilterCondition filter = new FilterCondition();

            filter.SystemId = account.SystemId;

            //get data of current date
            filter.DateFrom = DateTime.Now;
            filter.DateTo   = DateTime.Now;

            string strResult = cm.GetPhanQuyen(ref filter, account);

            if (strResult != CommonHeader.ResultOK)
            {
                ViewBag.Result = strResult;
                return(View("Index", filter));
            }

            ViewBag.SelectedMode  = filter.ListModeView;
            ViewBag.SelectedCapDo = filter.ListCapDo;
            IEnumerable <SelectListItem> initList = new List <SelectListItem>();

            ViewBag.SelectedGiaTriCapDo = initList;
            ViewBag.SelectedCongDoan    = filter.ListCongDoan;

            ViewBag.Result = strResult;
            return(View("Index", filter));
        }
        public override object Do(object obj)
        {
            BatchCreatePrePaymentBP bpObj = (BatchCreatePrePaymentBP)obj;

            if (bpObj == null)
            {
                return(null);
            }

            List <CommonDTO> resultList = new List <CommonDTO>();

            using (ISession session = Session.Open())
            {
                foreach (PrePaymentHeadDTO headDto in bpObj.PrePaymentHeadDTOs)
                {
                    UFIDA.U9.Cust.GS.FI.PrePaymentBE.PrePayment doc = UFIDA.U9.Cust.GS.FI.PrePaymentBE.PrePayment.Create();

                    SetPrePaymentHead(headDto, doc);

                    int lineNum = 10;//行号
                    foreach (PrePaymentLineDTO lineDto in headDto.PrePaymentLineDTOs)
                    {
                        UFIDA.U9.Cust.GS.FI.PrePaymentBE.PrePaymentLine line = UFIDA.U9.Cust.GS.FI.PrePaymentBE.PrePaymentLine.Create(doc);

                        SetPrePaymentLine(lineDto, line, lineNum);

                        lineNum = lineNum + 10;
                    }

                    CommonDTO result = new CommonDTO();
                    result.ID = doc.ID;//返回新创建的预付款通知单ID
                    resultList.Add(result);
                }
                session.Commit();
            }
            return(resultList);
        }
Esempio n. 6
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            try
            {
                string[]         Params              = null;
                string           sController         = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName;
                string           sAction             = filterContext.ActionDescriptor.ActionName;
                string           sControllerAction   = sController + sAction;
                CommonDAL        objCommonDAL        = new CommonDAL();
                CommonDTO        objCommonDTO        = new CommonDTO();
                LoginUserDetails objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails);
                if (objLoginUserDetails != null && objLoginUserDetails.CompanyDBConnectionString != null)
                {
                    objCommonDTO = objCommonDAL.GlobalRedirection(objLoginUserDetails.CompanyDBConnectionString, sControllerAction, objLoginUserDetails.LoggedInUserID);
                    //objCommonDTO = objCommonDAL.GlobalRedirectionForInitialCheck(objLoginUserDetails.CompanyDBConnectionString, sControllerAction, objLoginUserDetails.LoggedInUserID, out RedirectionType);
                    //if (RedirectionType != 0)//"temp" && RedirectionType != null)
                    //{
                    //    path = ConstEnum.Redirect[RedirectionType];
                    //    var sType = path.GetType();
                    var values = new System.Web.Routing.RouteValueDictionary();
                    //    foreach (var prop in sType.GetProperties(BindingFlags.Public | BindingFlags.Instance))
                    //    {
                    //        values.Add(prop.Name, Convert.ToString(prop.GetValue(path, null)));
                    //    }
                    if (objCommonDTO != null)
                    {
                        var sourceType = objCommonDTO.GetType();
                        foreach (var property in sourceType.GetProperties(BindingFlags.Public | BindingFlags.Instance))
                        {
                            if (Convert.ToString(property.GetValue(objCommonDTO, null)) != null && Convert.ToString(property.GetValue(objCommonDTO, null)) != "")
                            {
                                if (property.Name == "Parameter")
                                {
                                    Params = Convert.ToString(property.GetValue(objCommonDTO, null)).Split(',');
                                }
                                else
                                {
                                    values.Add(property.Name, Convert.ToString(property.GetValue(objCommonDTO, null)));
                                }
                            }
                        }
                        if (Params != null)
                        {
                            for (int i = 0; i < Params.Length; i = i + 2)
                            {
                                values.Add(Params[i], Params[i + 1]);
                            }
                        }
                    }

                    if (values.Keys.Count != 0)
                    {
                        if (values.Values.Contains("UserDetails") && values.Values.Contains("ChangePassword"))
                        {
                            Common.Common.SetSessionValue("IsChangePassword", true);
                        }
                        else
                        {
                            Common.Common.SetSessionValue("IsChangePassword", false);
                        }
                        filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(values));
                    }
                }
                //}
            }
            catch (Exception e)
            {
                throw e;
            }
        }