Пример #1
0
        public static bool ConfigCheckDate(DateTime checkDate)
        {
            string        startDate   = string.Format("{0}/{1}/{2}", checkDate.Year, checkDate.Month, checkDate.Day);
            List <string> paramValues = new List <string>();
            Dictionary <string, string> dictValues = new Dictionary <string, string>();

            dictValues.Add("ApplicationOrderCode", "FB_CHECKDATE");
            dictValues.Add("TaskStartDate", startDate);
            dictValues.Add("TaskStartTime", checkDate.ToString("HH:mm"));
            dictValues.Add("ProcessCycle", "Month");
            dictValues.Add("ProcessWcfUrl", FBCommonBLL.FBServiceUrl);
            dictValues.Add("WcfFuncName", "EventTriggerProcess");

            XElement xElement = XElement.Parse(xml);

            xElement.Elements().ToList().ForEach(item =>
            {
                string value = "";
                dictValues.TryGetValue(item.Name.LocalName, out value);
                if (value != null)
                {
                    item.Value = value;
                }
            });
            EngineConfigWS.EngineWcfGlobalFunctionClient engineService = new EngineConfigWS.EngineWcfGlobalFunctionClient();

            engineService.SaveEventData(@"<?xml version=""1.0"" encoding=""utf-8"" ?>" + xElement.ToString());

            return(true);
        }
Пример #2
0
        public static bool ConfigCheckDate(DateTime checkDate)
        {
            string startDate = string.Format("{0}/{1}/{2}", checkDate.Year, checkDate.Month, checkDate.Day);
            List<string> paramValues = new List<string>();
            Dictionary<string, string> dictValues = new Dictionary<string,string>();
            dictValues.Add("ApplicationOrderCode", "FB_CHECKDATE");
            dictValues.Add("TaskStartDate", startDate);
            dictValues.Add("TaskStartTime", checkDate.ToString("HH:mm"));
            dictValues.Add("ProcessCycle", "Month");
            dictValues.Add("ProcessWcfUrl", FBCommonBLL.FBServiceUrl);
            dictValues.Add("WcfFuncName", "EventTriggerProcess");
            
            XElement xElement = XElement.Parse(xml);

            xElement.Elements().ToList().ForEach(item =>
                {
                    string value = "";
                    dictValues.TryGetValue(item.Name.LocalName, out value);
                    if (value != null)
                    {
                        item.Value = value; 
                    }                   
                });
            EngineConfigWS.EngineWcfGlobalFunctionClient engineService = new EngineConfigWS.EngineWcfGlobalFunctionClient();

            engineService.SaveEventData(@"<?xml version=""1.0"" encoding=""utf-8"" ?>" + xElement.ToString());

            return true;
        }
Пример #3
0
 /// <summary>
 /// 指定转正提醒日期
 /// </summary>
 /// <param name="employeeCheck"></param>
 public void EmployeeCheckAlarm(T_HR_EMPLOYEECHECK employeeCheck)
 {
     try
     {
         SMT.Foundation.Log.Tracer.Debug("调用转正提醒:EmployeeCheckBLL类EmployeeCheckAlarm方法");
         string submitName = "";
         var    ents       = from a in dal.GetObjects <T_HR_EMPLOYEE>()
                             where a.EMPLOYEEID == employeeCheck.OWNERID
                             select a;
         EngineWS.EngineWcfGlobalFunctionClient Client = new EngineWS.EngineWcfGlobalFunctionClient();
         EngineWS.CustomUserMsg userMsg = new EngineWS.CustomUserMsg();
         userMsg.FormID = employeeCheck.BEREGULARID;
         userMsg.UserID = employeeCheck.CREATEUSERID;
         EngineWS.CustomUserMsg[] List = new EngineWS.CustomUserMsg[1];
         List[0] = userMsg;
         if (ents.Count() > 0)
         {
             submitName = ents.FirstOrDefault().EMPLOYEECNAME;
         }
         Client.ApplicationMsgTrigger(List, "HR", "T_HR_EMPLOYEECHECK", Utility.ObjListToXml(employeeCheck, "HR", submitName), EngineWS.MsgType.Msg);
         Client.ApplicationMsgTrigger(List, "HR", "T_HR_EMPLOYEECHECK", Utility.ObjListToXml(employeeCheck, "HR", submitName), EngineWS.MsgType.Task);
     }
     catch (Exception ex)
     {
         SMT.Foundation.Log.Tracer.Debug("调用EmployeeCheckBLL类EmployeeCheckAlarm方法错误:" + ex.Message);
     }
 }
Пример #4
0
        /// <summary>
        /// 考勤异常提醒消息
        /// </summary>
        /// <param name="employeeCheck"></param>
        public void AbnormRecordCheckAlarm(string strEmployeeId)
        {
            string submitName     = string.Empty;
            string strAttendState = (Convert.ToInt32(Common.AttendanceState.Abnormal) + 1).ToString();
            var    ents           = from a in dal.GetObjects <T_HR_ATTENDANCERECORD>()
                                    where a.EMPLOYEEID == strEmployeeId && a.ATTENDANCESTATE == strAttendState
                                    select a;

            if (ents.Count() == 0)
            {
                return;
            }

            T_HR_ATTENDANCERECORD entTemp = ents.FirstOrDefault();

            EngineWS.EngineWcfGlobalFunctionClient Client = new EngineWS.EngineWcfGlobalFunctionClient();
            EngineWS.CustomUserMsg userMsg = new EngineWS.CustomUserMsg();
            userMsg.FormID = Guid.NewGuid().ToString();
            userMsg.UserID = entTemp.EMPLOYEEID;
            EngineWS.CustomUserMsg[] List = new EngineWS.CustomUserMsg[1];
            List[0] = userMsg;
            if (ents.Count() > 0)
            {
                submitName = ents.FirstOrDefault().EMPLOYEENAME;
            }
            Client.ApplicationMsgTrigger(List, "HR", "T_HR_EMPLOYEESIGNINRECORD", Utility.ObjListToXml(entTemp, "HR", submitName), EngineWS.MsgType.Msg);
        }
Пример #5
0
 /// <summary>
 /// 关闭引擎异常消息提醒
 /// </summary>
 /// <param name="strModelCode">模块实体名</param>
 /// <param name="strEmployeeId">接受消息的员工Id</param>
 public static void CloseAttendAbnormAlarmMsg(string strModelCode, string strEmployeeId)
 {
     try
     {
         EngineWS.EngineWcfGlobalFunctionClient clientEngine = new EngineWS.EngineWcfGlobalFunctionClient();
         clientEngine.ModelMsgClose(strModelCode, strEmployeeId);
     }
     catch (Exception ex)
     {
         SaveLog("关闭引擎异常消息提醒发生错误,接受参数:strModelCode:" + strModelCode + ", strEmployeeId:"
                 + strEmployeeId + "。出错详细信息如下:" + ex.ToString());
     }
 }
Пример #6
0
 /// <summary>
 /// 根据业务系统主键ID删除定时触发
 /// </summary>
 ///  <param name="entityName">业务系统模块名</param>
 /// <param name="businessID">业务系统主键ID(即定时触发表里面的BUSINESSID)</param>
 public static void DeleteTrigger(string entityName, string businessID)
 {
     try
     {
         SMT.Foundation.Log.Tracer.Debug("业务模块: " + entityName + " 主键ID: " + businessID + " 调用流程删除定时触发方法");
         EngineWS.EngineWcfGlobalFunctionClient EngineClient = new EngineWS.EngineWcfGlobalFunctionClient();
         EngineClient.DeleteTrigger(businessID);//没有返回值,就不判断了
     }
     catch (Exception ex)
     {
         SMT.Foundation.Log.Tracer.Debug("业务模块: " + entityName + " 主键ID: " + businessID + "调用流程删除定时触发方法出错  " + ex.Message);
     }
 }
Пример #7
0
        /// <summary>
        /// 对指定发薪日期定时提醒
        /// </summary>
        /// <param name="CreateUserID"></param>
        /// <returns></returns>
        public void TimingPay(T_HR_SALARYSOLUTION salarysolution)
        {
            string submitName = "";
            var    ents       = from a in dal.GetObjects <T_HR_EMPLOYEE>()
                                where a.EMPLOYEEID == salarysolution.OWNERID
                                select a;

            EngineWS.EngineWcfGlobalFunctionClient Client = new EngineWS.EngineWcfGlobalFunctionClient();
            EngineWS.CustomUserMsg userMsg = new EngineWS.CustomUserMsg();
            userMsg.FormID = Guid.NewGuid().ToString();
            userMsg.UserID = salarysolution.CREATEUSERID;
            EngineWS.CustomUserMsg[] List = new EngineWS.CustomUserMsg[1];
            List[0] = userMsg;
            if (ents.Count() > 0)
            {
                submitName = ents.FirstOrDefault().EMPLOYEECNAME;
            }
            Client.ApplicationMsgTrigger(List, "HR", "T_HR_SALARYSOLUTION", Utility.ObjListToXml(salarysolution, "HR", submitName), EngineWS.MsgType.Msg);
        }
Пример #8
0
        /// <summary>
        /// 员工合同到期提醒
        /// </summary>
        /// <param name="employeeCheck"></param>
        public void EmployeeContractAlarm(T_HR_EMPLOYEECONTRACT entity)
        {
            string submitName = "";
            var    ents       = from a in dal.GetObjects <T_HR_EMPLOYEE>()
                                where a.EMPLOYEEID == entity.OWNERID
                                select a;

            EngineWS.EngineWcfGlobalFunctionClient Client = new EngineWS.EngineWcfGlobalFunctionClient();
            EngineWS.CustomUserMsg userMsg = new EngineWS.CustomUserMsg();
            userMsg.FormID = entity.EMPLOYEECONTACTID;
            userMsg.UserID = entity.CREATEUSERID;
            EngineWS.CustomUserMsg[] List = new EngineWS.CustomUserMsg[1];
            List[0] = userMsg;
            if (ents.Count() > 0)
            {
                submitName = ents.FirstOrDefault().EMPLOYEECNAME;
            }
            SMT.Foundation.Log.Tracer.Debug("合同到期开始调用ApplicationMsgTrigger。ID:" + entity.EMPLOYEECONTACTID);
            Client.ApplicationMsgTrigger(List, "HR", "T_HR_EMPLOYEECONTRACT", Utility.ObjListToXml(entity, "HR", submitName), EngineWS.MsgType.Task);
        }
Пример #9
0
        /// <summary>
        /// 添加定时触发
        /// </summary>
        /// <param name="paras"></param>
        public static void SendEngineEventTriggerData(IList <object> paras)
        {
            StringBuilder strRes = new StringBuilder();

            EngineWS.T_WF_TIMINGTRIGGERACTIVITY trigger = new EngineWS.T_WF_TIMINGTRIGGERACTIVITY();
            trigger.TRIGGERID           = System.Guid.NewGuid().ToString();
            trigger.COMPANYID           = paras[0].ToString();
            trigger.SYSTEMCODE          = paras[1].ToString();
            trigger.MODELCODE           = paras[2].ToString();
            trigger.BUSINESSID          = paras[3].ToString();
            trigger.TRIGGERACTIVITYTYPE = 2;
            if (paras[4].ToString().IndexOf(':') < 0)
            {
                trigger.TRIGGERTIME = Convert.ToDateTime(paras[4].ToString() + " 8:00:00");
            }
            else
            {
                trigger.TRIGGERTIME = Convert.ToDateTime(paras[4].ToString());
            }
            trigger.TRIGGERROUND       = 0;
            trigger.MESSAGEBODY        = paras[8].ToString();
            trigger.WCFURL             = "EngineTriggerService.svc";
            trigger.FUNCTIONNAME       = paras[11].ToString();
            trigger.FUNCTIONPARAMTER   = paras[12].ToString();
            trigger.PAMETERSPLITCHAR   = paras[13].ToString();
            trigger.WCFBINDINGCONTRACT = "customBinding";
            trigger.TRIGGERSTATUS      = 0;
            trigger.TRIGGERDESCRIPTION = "EventTrigger";
            trigger.TRIGGERTYPE        = "user";


            //strRes.Append("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
            //strRes.Append("<System>");
            //strRes.Append("<CompanyCode>" + paras[0].ToString() + "</CompanyCode>");
            //strRes.Append("<SystemCode>" + paras[1].ToString() + "</SystemCode>");
            //strRes.Append("<ModelCode>" + paras[2].ToString() + "</ModelCode>");
            //strRes.Append("<ApplicationOrderCode>" + paras[3].ToString() + "</ApplicationOrderCode>");
            ////strRes.Append("<TaskStartDate>" + paras[4].ToString() + "</TaskStartDate>");
            //if(paras[4].ToString().IndexOf(':')<0)
            //    strRes.Append("<TaskStartDate>" + paras[4].ToString()+" 8:00:00" + "</TaskStartDate>");
            //else
            //    strRes.Append("<TaskStartDate>" + paras[4].ToString() + "</TaskStartDate>");
            ////strRes.Append("<TaskStartDate>" + Convert.ToDateTime("2012/12/6 16:40:26").ToString() + "</TaskStartDate>");
            //strRes.Append("<TaskStartTime>" + paras[5].ToString() + "</TaskStartTime>");
            //strRes.Append("<ProcessCycle>" + paras[6].ToString() + "</ProcessCycle>");
            //strRes.Append("<ReceiveUser>" + paras[7].ToString() + "</ReceiveUser>");
            //strRes.Append("<MessageBody>" + paras[8].ToString() + "</MessageBody>");
            //strRes.Append("<MsgLinkUrl>" + paras[9].ToString() + "</MsgLinkUrl>");
            //strRes.Append("<ProcessWcfUrl>" + "EngineTriggerService.svc" + "</ProcessWcfUrl>");
            //strRes.Append("<WcfFuncName>" + paras[11].ToString() + "</WcfFuncName>");
            //strRes.Append("<WcfFuncParamter>" + paras[12].ToString() + "</WcfFuncParamter>");
            //strRes.Append("<WcfParamSplitChar>" + paras[13].ToString() + "</WcfParamSplitChar>");
            //strRes.Append("<WcfBinding>" + paras[14].ToString() + "</WcfBinding>");
            //strRes.Append("</System>");

            //return strRes.ToString();
            SMT.Foundation.Log.Tracer.Debug("发出提醒定时触发数据:\r\n" + strRes.ToString());
            EngineWS.EngineWcfGlobalFunctionClient EngineClient = new EngineWS.EngineWcfGlobalFunctionClient();
            //EngineClient.SaveEventData(strRes.ToString());
            EngineClient.WFAddTimingTrigger(trigger);
            //EngineClient.WFAddTimingTrigger(trigger);
        }
Пример #10
0
        /// <summary>
        /// 保存数据变化到引擎服务
        /// </summary>
        /// <typeparam name="T">实体类</typeparam>
        /// <param name="oldObject">修改前的实体</param>
        /// <param name="newObject">修改后的数据</param>
        /// <returns>保存结果</returns>
        public static string SaveTriggerData <T>(T oldObject, T newObject) where T : class
        {
            Type etype = oldObject.GetType();

            PropertyInfo[] infos = etype.GetProperties();

            EntityObject oldEnt = oldObject as EntityObject;
            EntityObject newEnt = newObject as EntityObject;

            XmlDocument    xd = new XmlDocument(); //表示XML文档
            XmlDeclaration xde;                    //表示 XML 声明节点:<?xml version='1.0'...?>

            xde            = xd.CreateXmlDeclaration("1.0", null, null);
            xde.Encoding   = "gb2312";
            xde.Standalone = "yes";
            xd.AppendChild(xde);                       //<?xml version="1.0" encoding="UTF-8" standalone="yes"?>生成结束

            XmlElement xe = xd.CreateElement("table"); //创建一个table根元素

            xd.AppendChild(xe);                        //table根元素创建完成

            //查找<table>
            XmlNode table = xd.SelectSingleNode("table");

            //在<table>之下创建元素<ApplicationSystem>
            XmlElement ApplicationSystem = xd.CreateElement("ApplicationSystem");

            //人事系统
            ApplicationSystem.AppendChild(xd.CreateTextNode("0"));
            table.AppendChild(ApplicationSystem);


            //在<table>之下创建元素<CompanyCode>
            XmlElement   CompanyCode = xd.CreateElement("CompanyCode");
            PropertyInfo corpProp    = infos.SingleOrDefault(p => p.Name == "UPDATEDEPARTMENTID");

            if (corpProp != null)
            {
                object corp = corpProp.GetValue(newObject, null);
                CompanyCode.AppendChild(xd.CreateTextNode(corp == null ? "" : corp.ToString()));
                table.AppendChild(CompanyCode);
            }

            //在<table>之下创建元素<OperationUser>
            XmlElement OperationUser = xd.CreateElement("OperationUser");
            //获取修改人的信息
            PropertyInfo userProp = infos.SingleOrDefault(p => p.Name == "UPDATEUSERID");

            if (userProp != null)
            {
                object user = userProp.GetValue(newObject, null);
                OperationUser.AppendChild(xd.CreateTextNode(user == null ? "" : user.ToString()));
                table.AppendChild(CompanyCode);
            }

            //在<table>之下创建元素<TableName>
            XmlElement TableName = xd.CreateElement("TableName");

            TableName.AppendChild(xd.CreateTextNode(oldObject.GetType().Name));
            table.AppendChild(TableName);


            if (oldEnt == null || newEnt == null)
            {
                return("");
            }

            //添加<TableKey>
            XmlElement TableKey = xd.CreateElement("TableKey");

            table.AppendChild(TableKey);

            if (oldEnt != null && oldEnt.EntityKey != null && oldEnt.EntityKey.EntityKeyValues != null && oldEnt.EntityKey.EntityKeyValues.Count() > 0)
            {
                foreach (var key in oldEnt.EntityKey.EntityKeyValues)
                {
                    //TableKeyName
                    XmlElement TableKeyName = xd.CreateElement("TableKeyName");
                    TableKeyName.AppendChild(xd.CreateTextNode(key.Key));
                    TableKey.AppendChild(TableKeyName);

                    XmlElement TableKeyValue = xd.CreateElement("TableKeyValue");
                    TableKeyValue.AppendChild(xd.CreateTextNode((key.Value == null) ? "" : key.Value.ToString()));
                    TableKey.AppendChild(TableKeyValue);
                }
            }

            //添加<FieldString>
            foreach (PropertyInfo prop in infos)
            {
                if (prop.PropertyType.BaseType == typeof(EntityReference) ||
                    prop.PropertyType.BaseType == typeof(RelatedEnd) ||
                    prop.PropertyType == typeof(System.Data.EntityState) ||
                    prop.PropertyType == typeof(System.Data.EntityKey)
                    )
                {
                    continue;
                }


                //关键字段跳过
                if (oldEnt != null && oldEnt.EntityKey != null && oldEnt.EntityKey.EntityKeyValues != null && oldEnt.EntityKey.EntityKeyValues.Count() > 0)
                {
                    bool isKeyField = false;
                    foreach (var key in oldEnt.EntityKey.EntityKeyValues)
                    {
                        if (key.Key == prop.Name)
                        {
                            isKeyField = true;
                            break;
                        }
                    }
                    if (isKeyField)
                    {
                        continue;
                    }
                }


                //生成外键的
                if (prop.PropertyType.BaseType == typeof(System.Data.Objects.DataClasses.EntityObject))
                {
                    PropertyInfo refProp = infos.SingleOrDefault(p => p.Name == (prop.Name + "Reference"));

                    EntityReference reference = refProp.GetValue(oldEnt, null) as EntityReference;

                    if (!reference.IsLoaded)
                    {
                        reference.Load();
                    }

                    EntityObject oldEntRef = prop.GetValue(oldEnt, null) as EntityObject;
                    EntityObject newEntRef = prop.GetValue(newEnt, null) as EntityObject;

                    foreach (var key in oldEntRef.EntityKey.EntityKeyValues)
                    {
                        //在<table>之下创建元素<FieldString>
                        XmlElement FieldString = xd.CreateElement("FieldString");
                        table.AppendChild(FieldString);

                        XmlElement FieldName = xd.CreateElement("FieldName");
                        FieldName.AppendChild(xd.CreateTextNode(key.Key));
                        FieldString.AppendChild(FieldName);

                        XmlElement Field_Old_Value = xd.CreateElement("Field_Old_Value");
                        Field_Old_Value.AppendChild(xd.CreateTextNode((key.Value == null) ? "" : key.Value.ToString()));
                        FieldString.AppendChild(Field_Old_Value);

                        XmlElement Field_New_Value = xd.CreateElement("Field_New_Value");

                        PropertyInfo[] refinfos        = prop.PropertyType.GetProperties();
                        PropertyInfo   refEntProp      = refinfos.SingleOrDefault(p => p.Name == key.Key);
                        object         refEntPropValue = refEntProp.GetValue(newEntRef, null);

                        Field_New_Value.AppendChild(xd.CreateTextNode((refEntPropValue == null) ? "" : refEntPropValue.ToString()));
                        FieldString.AppendChild(Field_New_Value);
                    }
                }
                else
                {
                    //prop.Name
                    //在<table>之下创建元素<FieldString>
                    XmlElement FieldString = xd.CreateElement("FieldString");
                    table.AppendChild(FieldString);

                    XmlElement FieldName = xd.CreateElement("FieldName");
                    FieldName.AppendChild(xd.CreateTextNode(prop.Name));
                    FieldString.AppendChild(FieldName);

                    XmlElement Field_Old_value = xd.CreateElement("Field_Old_Value");
                    object     oldvalue        = prop.GetValue(oldEnt, null);
                    Field_Old_value.AppendChild(xd.CreateTextNode((oldvalue == null) ? "" : oldvalue.ToString()));
                    FieldString.AppendChild(Field_Old_value);

                    XmlElement Field_New_value = xd.CreateElement("Field_New_Value");
                    object     newvalue        = prop.GetValue(newEnt, null);
                    Field_New_value.AppendChild(xd.CreateTextNode((newvalue == null) ? "" : newvalue.ToString()));
                    FieldString.AppendChild(Field_New_value);
                }
            }

            EngineWS.EngineWcfGlobalFunctionClient engClient = new EngineWS.EngineWcfGlobalFunctionClient();
            string rslt = string.Empty;// engClient.SaveTriggerData(xd.OuterXml);

            return(rslt);
        }
Пример #11
0
        /// <summary>
        /// 根据传回的XML,添加还款申请信息
        /// </summary>
        /// <param name="eGFunc"></param>
        /// <returns></returns>
        private static string RepayApplyAdd(IEnumerable<XElement> eGFunc)
        {
            try
            {
                if (eGFunc.Count() == 0)
                {
                    return "";
                }
                string strEmployeeID = string.Empty;
                string strOwnerID = string.Empty;
                string strOwnerName = string.Empty;
                string strOwnerPostID = string.Empty;
                string strOwnerPostName = string.Empty;
                string strOwnerDepartmentID = string.Empty;
                string strOwnerDepartmentName = string.Empty;
                string strOwnerCompanyID = string.Empty;
                string strOwnerCompanyName = string.Empty;
                string strCheckState = string.Empty;
                string strCreateCompanyID = string.Empty;
                string strCreateCompanyName = string.Empty;
                string strCreateDepartmentID = string.Empty;
                string strCreateDepartmentName = string.Empty;
                string strCreatePostID = string.Empty;
                string strCreatePostName = string.Empty;
                string strCreateID = string.Empty;
                string strCreateName = string.Empty;
                string strBorrowMasterID = string.Empty;
                decimal dBorrowTotal = 0;

                foreach (var q in eGFunc)
                {
                    string strName = q.Attribute("Name").Value;
                    switch (strName)
                    {
                        case "CREATEUSERID":
                            strEmployeeID = q.Attribute("Value").Value;
                            break;
                        case "OWNERID":
                            strOwnerID = q.Attribute("Value").Value;
                            break;
                        case "OWNERNAME":
                            strOwnerName = q.Attribute("Value").Value;
                            break;
                        case "OWNERPOSTID":
                            strOwnerPostID = q.Attribute("Value").Value;
                            break;
                        case "OWNERPOSTNAME":
                            strOwnerPostName = q.Attribute("Value").Value;
                            break;
                        case "OWNERDEPARTMENTID":
                            strOwnerDepartmentID = q.Attribute("Value").Value;
                            break;
                        case "OWNERDEPARTMENTNAME":
                            strOwnerDepartmentName = q.Attribute("Value").Value;
                            break;
                        case "OWNERCOMPANYID":
                            strOwnerCompanyID = q.Attribute("Value").Value;
                            break;
                        case "OWNERCOMPANYNAME":
                            strOwnerCompanyName = q.Attribute("Value").Value;
                            break;
                        case "CHECKSTATE":
                            strCheckState = q.Attribute("Value").Value;
                            break;
                        case "CREATEID":
                            strCreateID = q.Attribute("Value").Value;
                            break;
                        case "CREATENAME":
                            strCreateName = q.Attribute("Value").Value;
                            break;
                        case "CREATEPOSTID":
                            strCreatePostID = q.Attribute("Value").Value;
                            break;
                        case "CREATEPOSTNAME":
                            strCreatePostName = q.Attribute("Value").Value;
                            break;
                        case "CREATEDEPARTMENTID":
                            strCreateDepartmentID = q.Attribute("Value").Value;
                            break;
                        case "CREATEDEPARTMENTNAME":
                            strCreateDepartmentName = q.Attribute("Value").Value;
                            break;
                        case "CREATECOMPANYID":
                            strCreateCompanyID = q.Attribute("Value").Value;
                            break;
                        case "CREATECOMPANYNAME":
                            strCreateCompanyName = q.Attribute("Value").Value;
                            break;
                        case "BORROWAPPLYMASTERID":
                            strBorrowMasterID = q.Attribute("Value").Value;
                            break;
                    }
                }
                DailyManagementServices doc = new DailyManagementServices();
                string employeeid = strEmployeeID.Replace("{", "").Replace("}", "");

                T_FB_BORROWAPPLYMASTER borMaster = doc.GetBorrowApplyMasterByID(strBorrowMasterID);
                T_FB_REPAYAPPLYMASTER entity = new T_FB_REPAYAPPLYMASTER();
                entity.REPAYAPPLYMASTERID = Guid.NewGuid().ToString();
                entity.CHECKSTATES = 0;
                entity.CREATECOMPANYID = borMaster.CREATECOMPANYID;
                entity.CREATECOMPANYNAME = borMaster.CREATECOMPANYNAME;
                entity.CREATEDATE = DateTime.Now;
                entity.CREATEDEPARTMENTID = borMaster.CREATEDEPARTMENTID;
                entity.CREATEDEPARTMENTNAME = borMaster.CREATEDEPARTMENTNAME;
                entity.CREATEPOSTID = borMaster.CREATEPOSTID;
                entity.CREATEPOSTNAME = borMaster.CREATEPOSTNAME;
                entity.CREATEUSERID = borMaster.CREATEUSERID;
                entity.CREATEUSERNAME = borMaster.CREATEUSERNAME;
                entity.EDITSTATES = 0;
                entity.OWNERCOMPANYID = borMaster.OWNERCOMPANYID;
                entity.OWNERCOMPANYNAME = borMaster.OWNERCOMPANYNAME;
                entity.OWNERDEPARTMENTID = borMaster.OWNERDEPARTMENTID;
                entity.OWNERDEPARTMENTNAME = borMaster.OWNERDEPARTMENTNAME;
                entity.OWNERID = borMaster.OWNERID;
                entity.OWNERNAME = borMaster.OWNERNAME;
                entity.OWNERPOSTID = borMaster.OWNERPOSTID;
                entity.OWNERPOSTNAME = borMaster.OWNERPOSTNAME;
                entity.PROJECTEDREPAYDATE = DateTime.Now;
                entity.REMARK = "";
                entity.UPDATEDATE = DateTime.Now;
                entity.UPDATEUSERID = borMaster.UPDATEUSERID;
                entity.UPDATEUSERNAME = borMaster.UPDATEUSERNAME;
                entity.REPAYTYPE = borMaster.REPAYTYPE;
                entity.TOTALMONEY = 0;
                entity.T_FB_BORROWAPPLYMASTER = borMaster;

                //从表操作
                List<object> masterCode = new List<object>();
                masterCode.Add(entity.T_FB_BORROWAPPLYMASTER.BORROWAPPLYMASTERID);
                List<T_FB_BORROWAPPLYDETAIL> BorDetail = doc.GetBorrowApplyDetailByMasterID(masterCode);
                List<T_FB_REPAYAPPLYDETAIL> RepDetail = new List<T_FB_REPAYAPPLYDETAIL>();//还款从表

                dBorrowTotal = 0;
                foreach (var detail in BorDetail)
                {
                    T_FB_REPAYAPPLYDETAIL RepayDetailInfo = new T_FB_REPAYAPPLYDETAIL();
                    RepayDetailInfo.REPAYAPPLYDETAILID = Guid.NewGuid().ToString();
                    RepayDetailInfo.REPAYAPPLYDETAILID = System.Guid.NewGuid().ToString();
                    RepayDetailInfo.BORROWMONEY = detail.BORROWMONEY;
                    RepayDetailInfo.REMARK = detail.REMARK;
                    RepayDetailInfo.T_FB_SUBJECT = detail.T_FB_SUBJECT;
                    RepayDetailInfo.T_FB_BORROWAPPLYDETAIL = detail;
                    RepayDetailInfo.UPDATEDATE = DateTime.Now;
                    RepayDetailInfo.CREATEDATE = DateTime.Now;
                    RepayDetailInfo.T_FB_REPAYAPPLYMASTER = entity;
                    RepayDetailInfo.CREATEUSERID = detail.CREATEUSERID;
                    RepayDetailInfo.UPDATEUSERID = detail.UPDATEUSERID;
                    RepayDetailInfo.CHARGETYPE = 1;
                    RepayDetailInfo.REPAYMONEY = 0;
                    RepayDetailInfo.CREATEDATE = DateTime.Now;
                    dBorrowTotal += detail.BORROWMONEY;
                    RepDetail.Add(RepayDetailInfo);
                }
                entity.BRORROWEDMONEY = dBorrowTotal;

                string strRepayCode = string.Empty, strMsg = string.Empty;

                doc.AddRepayApplyMasterAndDetail(entity, RepDetail);

                SMT.SaaS.BLLCommonServices.EngineConfigWS.EngineWcfGlobalFunctionClient Client = new EngineWS.EngineWcfGlobalFunctionClient();
                EngineWS.CustomUserMsg[] user = new EngineWS.CustomUserMsg[1];
                user[0] = new EngineWS.CustomUserMsg() { UserID = entity.OWNERID, FormID = entity.REPAYAPPLYMASTERID };
                Dictionary<string, string> dic = new Dictionary<string, string>();
                dic.Add("BORROWAPPLYMASTERID", borMaster.BORROWAPPLYMASTERID);
                Client.ApplicationMsgTrigger(user, "FB", "T_FB_REPAYAPPLYMASTER", Utility.ObjListToXml<T_FB_REPAYAPPLYMASTER>(entity, "FB", null), EngineWS.MsgType.Task);

                return entity.REPAYAPPLYMASTERID;
            }
            catch (Exception e)
            {
                string abc = "<FB>Message=[" + e.Message + "]" + "<FB>Source=[" + e.Source + "]<FB>StackTrace=[" + e.StackTrace + "]<FB>TargetSite=[" + e.TargetSite + "]";
                Tracer.Debug(abc);
                return abc;
            }
        }