当前位置: 首页>>代码示例>>C#>>正文


C# BaseService.GetObjectValue方法代码示例

本文整理汇总了C#中BaseService.GetObjectValue方法的典型用法代码示例。如果您正苦于以下问题:C# BaseService.GetObjectValue方法的具体用法?C# BaseService.GetObjectValue怎么用?C# BaseService.GetObjectValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BaseService的用法示例。


在下文中一共展示了BaseService.GetObjectValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessApproved

        /// <summary>
        /// [Hieu.Van]
        /// Xử lý duyệt động đa cấp
        /// ProcessApproved (Tài khoản Login - LoginID, Value Dropdownlist - userApprovedID, Id Bản ghi - recordID, Enum màn hình - type)
        /// </summary>
        /// <param name="LoginID"></param>
        /// <param name="userApprovedID"></param>
        /// <param name="recordID"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public string ProcessApproved(string host, Guid LoginID, Guid userApprovedID, Guid recordID, string type)
        {
            DataErrorCode status = DataErrorCode.Success;
            string stt = string.Empty;
            var Services = new BaseService();
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repoFIN_PurchaseRequest = new CustomBaseRepository<FIN_PurchaseRequest>(unitOfWork);
                var repoSys_UserApprove = new CustomBaseRepository<Sys_UserApprove>(unitOfWork);
                var repoSys_ConfigProcessApprove = new CustomBaseRepository<Sys_ConfigProcessApprove>(unitOfWork);
                var UserLogin = string.Empty;
                var record = GetData<FIN_PurchaseRequestEntity>(recordID, ConstantSql.hrm_hr_sp_get_PurchaseRequestById, UserLogin, ref stt).FirstOrDefault();
                var configProcess = repoSys_ConfigProcessApprove.FindBy(s => s.IsDelete == null && s.Function == type && s.CurrentStatus == record.Status).FirstOrDefault();
                double total = record.Total != null ? record.Total.Value : 0.0;
                List<ElementFormula> listFomula = new List<ElementFormula>();
                ElementFormula FomulaItem = new ElementFormula("Total", total, 0);
                ElementFormula statusItem = new ElementFormula(configProcess.NextStatusFormular, configProcess.NextStatusFormular, 1);
                listFomula.Add(FomulaItem);
                listFomula.Add(statusItem);
                string nextStatus = Services.GetObjectValue(new List<Cat_ElementEntity>(), listFomula, configProcess.NextStatusFormular).ToString();


                if (configProcess != null && userApprovedID == Guid.Empty && nextStatus != "Approved")
                {
                    return DataErrorCode.Error_NoUserApproved.ToString();
                }
                if (record.Status == EnumDropDown.Status.E_REJECTED.ToString())
                {
                    return DataErrorCode.Error_Reject.ToString();
                }
                var recordEdit = repoFIN_PurchaseRequest.FindBy(s => s.ID == recordID).FirstOrDefault();
                // lấy UserInfoID hiện tại của bản ghi
                var userApprovedCurrent = repoSys_UserApprove.FindBy(s => s.ID == recordEdit.UserApproveID).FirstOrDefault();
                // Kiểm tra tài khoản login có được phép Duyệt hay ko?
                if (LoginID == Guid.Empty || userApprovedCurrent.UserApproveID != LoginID)
                {
                    // kiểm tra nếu bản ghi có tk duyệt trống (tức bản ghi mới tạo) và tk login = tk tạo thì cho duyệt tiếp tục
                    if (recordEdit.UserApproveID == null && record.UserCreateID == LoginID)
                    {
                    }
                    else
                    {
                        return DataErrorCode.NoPermission.ToString();
                    }
                }
                recordEdit.Status = nextStatus;
                if (userApprovedID == Guid.Empty)
                {
                    recordEdit.UserApproveID = null;
                }
                else
                {
                    recordEdit.UserApproveID = userApprovedID;
                }
                repoFIN_PurchaseRequest.Edit(recordEdit);
                status = repoFIN_PurchaseRequest.SaveChanges();

                if (nextStatus != "Approved")
                {
                    status = SendMail_ToNextApproved(host, recordID, userApprovedID, nextStatus, type);
                }

                if (status == DataErrorCode.Success)
                {
                    //var configProcess = repoSys_ConfigProcessApprove.FindBy(s => s.IsDelete == null && s.Function == type && s.CurrentStatus == nextStatus).FirstOrDefault();
                    if (nextStatus == "Approved")
                    {
                        return DataErrorCode.Success.ToString();
                    }
                    else
                    {
                        return DataErrorCode.Success_Forward.ToString();
                    }
                }

                return status.ToString();
            }
        }
开发者ID:dtafe,项目名称:vnr,代码行数:89,代码来源:FIN_PurchaseRequestService.cs

示例2: SendMail_ToNextApproved

        /// <summary>
        /// Hieu.Van
        /// Gửi mail duyệt
        /// recordID : ID bản ghi
        /// userApprovedID : Id ngưởi nhận dc mail
        /// currentStatus : trạng thái hiện tại của bản ghi
        /// type : ApproveType.E_FIN_PurchaseRequest
        /// </summary>
        /// <param name="recordID"></param>
        /// <param name="userApprovedID"></param>
        /// <param name="currentStatus"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public DataErrorCode SendMail_ToNextApproved(string host, Guid recordID, Guid userApprovedID, string currentStatus, string type)
        {
            using (var context = new VnrHrmDataContext())
            {
                var Services = new BaseService();
                var UserLogin = string.Empty;
                string status = string.Empty;
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repoSys_UserApprove = new CustomBaseRepository<Sys_UserApprove>(unitOfWork);
                var repoSys_UserInfo = new CustomBaseRepository<Sys_UserInfo>(unitOfWork);
                var repoSys_ConfigProcessApprove = new CustomBaseRepository<Sys_ConfigProcessApprove>(unitOfWork);
                var repoSys_TemplateSendMail = new CustomBaseRepository<Sys_TemplateSendMail>(unitOfWork);

                string _typeTemplate = EnumDropDown.EmailType.E_APPROVED_PURCHASEREQUEST.ToString();
                var template = repoSys_TemplateSendMail.FindBy(s => s.Type == _typeTemplate).FirstOrDefault();
                if (template == null)
                    return DataErrorCode.Error_NoTemplateMail;

                var userApproved = repoSys_UserApprove.FindBy(s => s.ID == userApprovedID).FirstOrDefault();
                var lstUserInfo = repoSys_UserInfo.FindBy(s => s.ID != null).ToList();
                var userInfo = lstUserInfo.Where(s => s.ID == userApproved.UserApproveID).FirstOrDefault();
                var Profile = GetData<Hre_ProfileEntity>(Common.DotNetToOracle(userInfo.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, UserLogin, ref status).FirstOrDefault();
                var configProcess = repoSys_ConfigProcessApprove.FindBy(s => s.IsDelete == null && s.Function == type && s.CurrentStatus == currentStatus).FirstOrDefault();
         
                var record = GetData<FIN_PurchaseRequestEntity>(recordID, ConstantSql.hrm_hr_sp_get_PurchaseRequestById, UserLogin, ref status).FirstOrDefault();
                double total = record.Total != null ? record.Total.Value : 0.0;
                List<ElementFormula> listFomula = new List<ElementFormula>();
                ElementFormula FomulaItem = new ElementFormula("Total", total, 0);
                ElementFormula statusItem = new ElementFormula(configProcess.NextStatusFormular, configProcess.NextStatusFormular, 1);
                listFomula.Add(FomulaItem);
                listFomula.Add(statusItem);
                string nextStatus = Services.GetObjectValue(new List<Cat_ElementEntity>(), listFomula, configProcess.NextStatusFormular).ToString();

                var lstUserApprovedNextStatus = repoSys_UserApprove.FindBy(s => s.IsDelete == null && s.Type == type && s.CurrentStatus == nextStatus).ToList();
                var RequestUserInfo = lstUserInfo.Where(s => s.ID == record.UserCreateID).FirstOrDefault();

                string MailTo = Profile.Email;
                try 
	            {
                    string urlClickHere = host + "#Hrm_Main_Web/Fin_ApprovedPurchaseRequest/DetailPurchaseRequest/" + recordID + "#NewTab";
                    string dateFrom = record.From != null ? record.From.Value.ToString(ConstantFormat.HRM_Format_DayMonthYear.ToString()) : "...";
                    string dateTo = record.To != null ? record.To.Value.ToString(ConstantFormat.HRM_Format_DayMonthYear.ToString()) : "...";

                    #region process Link Content

                    string linkcontent = string.Empty;
                    foreach (var item in lstUserApprovedNextStatus)
                    {
                        var temp = lstUserInfo.Where(s => s.ID == item.UserApproveID).FirstOrDefault();
                        var name = temp.UserInfoName != null ? temp.UserInfoName : temp.UserLogin;

                        linkcontent += "<a href='" + host + "Fin_ApprovedPurchaseRequest/ProcessApprovedPage"
                                + "?loginID=" + userInfo.ID
                                + "&userApprovedID=" + item.ID
                                + "&recordID=" + recordID
                                + "'>Click this link to approve and forward to '" + name + "'<a/><br /><br />";
                    }
                    // trường hợp duyệt không có cấp cao hơn userApprovedID  Guid.Empty
                    if (lstUserApprovedNextStatus == null)
                    {
                        linkcontent += "<a href='" + host + "Fin_ApprovedPurchaseRequest/ProcessApprovedPage"
                                + "?loginID=" + userInfo.ID
                                + "&userApprovedID=" + Guid.Empty
                                + "&recordID=" + recordID
                                + "'>Click this link to approve<a/><br /><br />";
                    }
                    linkcontent += "<a href='" + host + "Fin_ApprovedPurchaseRequest/ProcessRejectPage"
                                + "?loginID=" + userInfo.ID
                                + "&recordID=" + recordID
                                + "'>Click this link to reject<a/><br /><br />";

                    linkcontent += "<a href='" + urlClickHere + "'>Click this link to view detail information and approve or reject<a/> <br /> ";
                    
                    #endregion
                    #region magreData

                    string[] strsParaKey = null;
                    string[] strsParaValues = null;
                    strsParaKey = new string[] 
                    { 
                        EnumDropDown.EmailType_APPROVED_PURCHASEREQUEST.E_PROFILENAME.ToString(), 
                        EnumDropDown.EmailType_APPROVED_PURCHASEREQUEST.E_USERINFONAME.ToString(), 
                        EnumDropDown.EmailType_APPROVED_PURCHASEREQUEST.E_FUNCTIONNAME.ToString(), 
                        EnumDropDown.EmailType_APPROVED_PURCHASEREQUEST.E_BUDGETOWNERNAME.ToString(), 
                        EnumDropDown.EmailType_APPROVED_PURCHASEREQUEST.E_SUPPLIERNAME.ToString(), 
                        EnumDropDown.EmailType_APPROVED_PURCHASEREQUEST.E_BUDGETCHARGEDIN.ToString(), 
                        EnumDropDown.EmailType_APPROVED_PURCHASEREQUEST.E_FROMTO.ToString(), 
//.........这里部分代码省略.........
开发者ID:dtafe,项目名称:vnr,代码行数:101,代码来源:FIN_PurchaseRequestService.cs

示例3: SendMail_ToNextApproved

        /// <summary>
        /// Hieu.Van
        /// Gửi mail duyệt
        /// recordID : ID bản ghi
        /// userApprovedID : Id ngưởi nhận dc mail
        /// currentStatus : trạng thái hiện tại của bản ghi
        /// type : ApproveType.E_FIN_Claim
        /// </summary>
        /// <param name="recordID"></param>
        /// <param name="userApprovedID"></param>
        /// <param name="currentStatus"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public DataErrorCode SendMail_ToNextApproved(string host, Guid recordID, Guid userApprovedID, string currentStatus, string type)
        {
            using (var context = new VnrHrmDataContext())
            {
                var Services = new BaseService();
                var UserLogin = string.Empty;
                string status = string.Empty;
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repoSys_UserApprove = new CustomBaseRepository<Sys_UserApprove>(unitOfWork);
                var repoSys_UserInfo = new CustomBaseRepository<Sys_UserInfo>(unitOfWork);
                var repoSys_ConfigProcessApprove = new CustomBaseRepository<Sys_ConfigProcessApprove>(unitOfWork);
                var repoSys_TemplateSendMail = new CustomBaseRepository<Sys_TemplateSendMail>(unitOfWork);

                string _typeTemplate = EnumDropDown.EmailType.E_APPROVED_CLAIM.ToString();
                var template = repoSys_TemplateSendMail.FindBy(s => s.Type == _typeTemplate).FirstOrDefault();
                if (template == null)
                    return DataErrorCode.Error_NoTemplateMail;

                var userApproved = repoSys_UserApprove.FindBy(s => s.ID == userApprovedID).FirstOrDefault();
                var lstUserInfo = repoSys_UserInfo.FindBy(s => s.ID != null).ToList();
                var userInfo = lstUserInfo.Where(s => s.ID == userApproved.UserApproveID).FirstOrDefault();
                var Profile = GetData<Hre_ProfileEntity>(Common.DotNetToOracle(userInfo.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, UserLogin, ref status).FirstOrDefault();
                var configProcess = repoSys_ConfigProcessApprove.FindBy(s => s.IsDelete == null && s.Function == type && s.CurrentStatus == currentStatus).FirstOrDefault();
            
                var record = GetData<FIN_ClaimEntity>(recordID, ConstantSql.hrm_hr_sp_get_ClaimById, UserLogin, ref status).FirstOrDefault();
                double total = record.Total != null ? record.Total.Value : 0.0;
                List<ElementFormula> listFomula = new List<ElementFormula>();
                ElementFormula FomulaItem = new ElementFormula("Total", total, 0);
                ElementFormula statusItem = new ElementFormula(configProcess.NextStatusFormular, configProcess.NextStatusFormular, 1);
                listFomula.Add(FomulaItem);
                listFomula.Add(statusItem);
                string nextStatus = Services.GetObjectValue(new List<Cat_ElementEntity>(), listFomula, configProcess.NextStatusFormular).ToString();

                var lstUserApprovedNextStatus = repoSys_UserApprove.FindBy(s => s.IsDelete == null && s.Type == type && s.CurrentStatus == nextStatus).ToList();
                var RequestUserInfo = lstUserInfo.Where(s => s.ID == record.UserCreateID).FirstOrDefault();

                string MailTo = Profile.Email;
                try
                {
                    string urlClickHere = host + "##Hrm_Main_Web/Fin_ApprovedClaim/DetailClaim/" + recordID + "#NewTab";

                    #region process Link Content

                    string linkcontent = string.Empty;
                    foreach (var item in lstUserApprovedNextStatus)
                    {
                        var temp = lstUserInfo.Where(s => s.ID == item.UserApproveID).FirstOrDefault();
                        var name = temp.UserInfoName != null ? temp.UserInfoName : temp.UserLogin;

                        linkcontent += "<a href='" + host + "Fin_ApprovedClaim/ProcessApprovedPage"
                                + "?loginID=" + userInfo.ID
                                + "&userApprovedID=" + item.ID
                                + "&recordID=" + recordID
                                + "'>Click this link to approve and forward to '" + name + "'<a/><br /><br />";
                    }
                    // trường hợp duyệt không có cấp cao hơn userApprovedID  Guid.Empty
                    if (lstUserApprovedNextStatus == null)
                    {
                        linkcontent += "<a href='" + host + "Fin_ApprovedClaim/ProcessApprovedPage"
                                + "?loginID=" + userInfo.ID
                                + "&userApprovedID=" + Guid.Empty
                                + "&recordID=" + recordID
                                + "'>Click this link to approve<a/><br /><br />";
                    }
                    linkcontent += "<a href='" + host + "Fin_ApprovedClaim/ProcessRejectPage"
                                + "?loginID=" + userInfo.ID
                                + "&recordID=" + recordID
                                + "'>Click this link to reject<a/><br /><br />";

                    linkcontent += "<a href='" + urlClickHere + "'>Click this link to view detail information and approve or reject<a/> <br /> ";

                    #endregion

                    #region magreData

                    string[] strsParaKey = null;
                    string[] strsParaValues = null;
                    strsParaKey = new string[] 
                    { 
                        EnumDropDown.EmailType_APPROVED_CLAIM.E_PROFILENAME.ToString(), 
                        EnumDropDown.EmailType_APPROVED_CLAIM.E_USERINFONAME.ToString(), 
                        EnumDropDown.EmailType_APPROVED_CLAIM.E_CLAIMNAME.ToString(), 
                        EnumDropDown.EmailType_APPROVED_CLAIM.E_CLAIMCODE.ToString(), 
                        EnumDropDown.EmailType_APPROVED_CLAIM.E_TRAVELREQUESTNAME.ToString(), 
                        EnumDropDown.EmailType_APPROVED_CLAIM.E_ACCOUNTCODE.ToString(), 
                        EnumDropDown.EmailType_APPROVED_CLAIM.E_TOTAL.ToString(), 
                        EnumDropDown.EmailType_APPROVED_CLAIM.E_STATUS.ToString(), 
//.........这里部分代码省略.........
开发者ID:dtafe,项目名称:vnr,代码行数:101,代码来源:FIN_ClaimService.cs


注:本文中的BaseService.GetObjectValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。