Example #1
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tbnSave_Click(object sender, EventArgs e)
        {
            CardTypeInfo objCardTypeInfo = GetInfoFormForm();

            //增加
            if (_eumActionType == ActionType.Insert)
            {
                if (objCardTypeInfo != null)
                {
                    _objSystemMessageInfo = _objCardTypeBLL.Insert(ref objCardTypeInfo, null);
                }

                if (_objSystemMessageInfo.Success)
                {
                    _objId         = objCardTypeInfo.Id;
                    _eumActionType = ActionType.Update;
                    this.Text      = CardTypeInfo.InfoName + "[修改]";
                }
            }
            //修改
            else if (_eumActionType == ActionType.Update)
            {
                if (objCardTypeInfo != null)
                {
                    _objSystemMessageInfo = _objCardTypeBLL.Update(objCardTypeInfo, null);
                }
            }
            else if (_eumActionType == ActionType.View || _eumActionType == ActionType.Init)
            {
                if (objCardTypeInfo != null)
                {
                    this.Close();
                }
            }
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tbnDelete_Click(object sender, EventArgs e)
        {
            if (dgvMain.SelectedRows.Count == 0)
            {
                MessageBoxForm.Show(new SystemMessage().GetInfoByCode("PleaseSelectData"), MessageBoxButtons.OK);
                return;
            }

            string strId = dgvMain.SelectedRows[0].Cells["Id"].Value.ToString();

            DialogResult objDialogResult = MessageBoxForm.Show(new SystemMessage().GetInfoByCode("ConfirmToDelete"), MessageBoxButtons.OKCancel);

            if (objDialogResult == DialogResult.OK)
            {
                _objSystemMessageInfo = _objCardTypeBLL.Delete(new Guid(strId), null);
            }
            else
            {
                return;
            }

            if (_objSystemMessageInfo.Success)
            {
                RefreshDataGridView();
            }
            MessageBoxForm.Show(_objSystemMessageInfo, MessageBoxButtons.OK);
        }
Example #3
0
        public SystemMessageInfo Update(CardTypeInfo theCardTypeInfo, DataAccessor theDataAccessor)
        {
            SystemMessage     _objSystemMessage     = new SystemMessage();
            SystemMessageInfo _objSystemMessageInfo = new SystemMessageInfo();

            //调用WebService,把theCardTypeInfo转成Hashtable再转成Xml以便调用
            Hashtable   objHashtable   = InfoToHashtable(theCardTypeInfo);
            XmlDocument objXmlDocument = Helper.FormatConvert.HashtableToXml(objHashtable);

            //Hashtable objHashtable2=  Helper.FormatConvert.XmlToHashtable(objXmlDocument);
            try
            {
                //Itsp2WebServiceNamespace.Itsp2WebService objItsp2WebService = new Itsp2WebServiceNamespace.Itsp2WebService();
                //objItsp2WebService.UpdateCardTypeByCondition(objXmlDocument.OuterXml);
                ServiceWrapper.Current.UpdateCardTypeByCondition(objXmlDocument.OuterXml);
            }
            catch (Exception e)
            {
                _objSystemMessageInfo           = _objSystemMessage.GetInfoByCode("WebServiceConnectFail");
                _objSystemMessageInfo.Success   = false;
                _objSystemMessageInfo.Exception = e.Message;
                return(_objSystemMessageInfo);
            }

            _objSystemMessageInfo = _objSystemMessage.GetInfoByCode("DataSaveSucceeded");
            return(_objSystemMessageInfo);
        }
Example #4
0
        public string GetRegisterType(Hashtable theHashTable, DataAccessor theDataAccessor)
        {
            SystemMessage     _objSystemMessage     = new SystemMessage();
            SystemMessageInfo _objSystemMessageInfo = new SystemMessageInfo();
            string            RegisterType          = string.Empty;
            XmlDocument       objXmlDocument        = Helper.FormatConvert.HashtableToXml(theHashTable);

            DataSet objDataSet = new DataSet();

            try
            {
                string strReturnXml = ServiceWrapper.Current.GetRegisterType(objXmlDocument.OuterXml);

                objDataSet = Helper.FormatConvert.XmlToDataSet(strReturnXml);
                if (objDataSet.Tables.Count > 0)
                {
                    RegisterType = objDataSet.Tables[0].Rows[0]["tcit_parameter_value"] == null ? "全部" : objDataSet.Tables[0].Rows[0]["tcit_parameter_value"].ToString();
                }
            }
            catch (Exception e)
            {
                _objSystemMessageInfo           = _objSystemMessage.GetInfoByCode("WebServiceConnectFail");
                _objSystemMessageInfo.Success   = false;
                _objSystemMessageInfo.Exception = e.Message;
            }
            //theSystemMessageInfo = _objSystemMessageInfo;
            return(RegisterType);
        }
Example #5
0
        private void MDIParent_Load(object sender, EventArgs e)
        {
            SystemMessageInfo objSystemMessageInfo = null;

            this.tsmlCardInfo.Visible = _objLoginBLL.IsRightByUserIdRightInfoListRightCode("Winform.Card.Info", null, ref objSystemMessageInfo);
            this.tsmlCardType.Visible = _objLoginBLL.IsRightByUserIdRightInfoListRightCode("Winform.Card.Type", null, ref objSystemMessageInfo);
        }
Example #6
0
        public CardTypeInfo GetById(Guid theId, DataAccessor theDataAccessor, ref SystemMessageInfo theSystemMessageInfo)
        {
            SystemMessage     _objSystemMessage     = new SystemMessage();
            SystemMessageInfo _objSystemMessageInfo = new SystemMessageInfo();

            if (theId == SystemConstant.GuidEmpty)
            {
                return(null);
            }

            //调用WebService,把theCardTypeInfo转成Hashtable再转成Xml以便调用
            Hashtable objHashtable = new Hashtable();

            objHashtable.Add("id", theId);
            //这里的后台写法仅支持传一个对象删除的方法
            //CardTypeInfo objCardTypeInfoCondition = new CardTypeInfo();
            //objCardTypeInfoCondition.Id = theId;
            //Hashtable objHashtable = InfoToHashtable(objCardTypeInfoCondition);
            XmlDocument objXmlDocument = Helper.FormatConvert.HashtableToXml(objHashtable);

            CardTypeInfo objCardTypeInfo = null;
            DataSet      objDataSet      = new DataSet();

            try
            {
                //Itsp2WebServiceNamespace.Itsp2WebService objItsp2WebService = new Itsp2WebServiceNamespace.Itsp2WebService();
                //string strReturnXml = objItsp2WebService.SelectCardTypeByCondition(objXmlDocument.OuterXml);

                string[] strReturnXml = ServiceWrapper.Current.SelectCardTypeByCondition(objXmlDocument.OuterXml, "effect_date desc", 1, 1);
                objDataSet = Helper.FormatConvert.XmlToDataSet(strReturnXml[1]);
                try
                {
                    if (objDataSet.Tables.Count > 0)
                    {
                        foreach (DataRow objDataRow in objDataSet.Tables[0].Rows)
                        {
                            objCardTypeInfo = GetInfoFromDataRow(objDataRow);
                        }
                    }
                }
                catch (Exception e)
                {
                    _objSystemMessageInfo           = _objSystemMessage.GetInfoByCode("WebServiceParseToInfoFail");
                    _objSystemMessageInfo.Success   = false;
                    _objSystemMessageInfo.Exception = e.Message;
                }
            }
            catch (Exception e)
            {
                _objSystemMessageInfo           = _objSystemMessage.GetInfoByCode("WebServiceConnectFail");
                _objSystemMessageInfo.Success   = false;
                _objSystemMessageInfo.Exception = e.Message;
            }


            theSystemMessageInfo = _objSystemMessageInfo;
            return(objCardTypeInfo);
        }
Example #7
0
        public IList <HistoryInfo> SearchByCondition(Dictionary <string, object> arr, DataAccessor theDataAccessor, ref SystemMessageInfo theSystemMessageInfo)
        {
            HistoryInfo         objHistoryInfo   = new HistoryInfo();
            IList <HistoryInfo> _objIHistoryInfo = new List <HistoryInfo>();
            //转换为Datatable
            DataTable dt = ConvertMethod.getDateTable("table", arr);
            //dataTable转换为XML
            string objXmlDocument = Helper.ConvertMethod.CDataToXml(dt);

            ////加密xml进行返回
            string Parameter = ConvertMethod.EncryptDESByKey8(objXmlDocument, ConfigurationSettings.AppSettings["password"]);

            DataSet objDataSet = new DataSet();

            try
            {
                string strReturnXml = ServiceWrapper.Current.SelectCarInformationHistoryRecord(Parameter);

                //先解密成xml格式
                strReturnXml = ConvertMethod.DecryptDESByKey8(strReturnXml, ConfigurationSettings.AppSettings["password"]);

                objDataSet = Helper.FormatConvert.CXmlToDataSet(strReturnXml);
                CurrentUser.Current.TotalCount = Int32.Parse(objDataSet.Tables["tb_card_historycount"].Rows[0]["count"].ToString());
                try
                {
                    if (objDataSet.Tables.Count > 2)
                    {
                        foreach (DataRow objDataRow in objDataSet.Tables["tb_card_history"].Rows)
                        {
                            objHistoryInfo = GetInfoFromDataRow(objDataRow);
                            _objIHistoryInfo.Add(objHistoryInfo);
                        }
                    }
                }
                catch (Exception e)
                {
                    _objSystemMessageInfo           = _objSystemMessage.GetInfoByCode("WebServiceParseToInfoFail");
                    _objSystemMessageInfo.Success   = false;
                    _objSystemMessageInfo.Exception = e.Message;
                }
            }
            catch (Exception e)
            {
                _objSystemMessageInfo           = _objSystemMessage.GetInfoByCode("WebServiceConnectFail");
                _objSystemMessageInfo.Success   = false;
                _objSystemMessageInfo.Exception = e.Message;
            }
            theSystemMessageInfo = _objSystemMessageInfo;
            return(_objIHistoryInfo);
        }
Example #8
0
        public CardInfo GetById(Guid theId, DataAccessor theDataAccessor, ref SystemMessageInfo theSystemMessageInfo)
        {
            SystemMessage     _objSystemMessage     = new SystemMessage();
            SystemMessageInfo _objSystemMessageInfo = new SystemMessageInfo();

            if (theId == SystemConstant.GuidEmpty)
            {
                return(null);
            }

            //调用WebService,把theCardTypeInfo转成Hashtable再转成Xml以便调用
            Hashtable objHashtable = new Hashtable();

            objHashtable.Add("id", theId);
            XmlDocument objXmlDocument = Helper.FormatConvert.HashtableToXml(objHashtable);

            CardInfo objCardInfoInfo = null;
            DataSet  objDataSet      = new DataSet();

            try
            {
                string[] strReturnXml = ServiceWrapper.Current.SelectCardInfoByCondition(objXmlDocument.OuterXml, 1, 1, "[status] DESC");
                objDataSet = Helper.FormatConvert.XmlToDataSet(strReturnXml[1]);
                try
                {
                    if (objDataSet.Tables.Count > 0)
                    {
                        foreach (DataRow objDataRow in objDataSet.Tables[0].Rows)
                        {
                            objCardInfoInfo = GetInfoFromDataRow(objDataRow);
                        }
                    }
                }
                catch (Exception e)
                {
                    _objSystemMessageInfo           = _objSystemMessage.GetInfoByCode("WebServiceParseToInfoFail");
                    _objSystemMessageInfo.Success   = false;
                    _objSystemMessageInfo.Exception = e.Message;
                }
            }
            catch (Exception e)
            {
                _objSystemMessageInfo           = _objSystemMessage.GetInfoByCode("WebServiceConnectFail");
                _objSystemMessageInfo.Success   = false;
                _objSystemMessageInfo.Exception = e.Message;
            }

            theSystemMessageInfo = _objSystemMessageInfo;
            return(objCardInfoInfo);
        }
Example #9
0
        public IList <CardTypeInfo> SearchAll(DataAccessor theDataAccessor, ref SystemMessageInfo theSystemMessageInfo)
        {
            SystemMessage     _objSystemMessage     = new SystemMessage();
            SystemMessageInfo _objSystemMessageInfo = new SystemMessageInfo();

            //调用WebService,把theCardTypeInfo转成Hashtable再转成Xml以便调用
            IList <CardTypeInfo> objIListCardTypeInfo = new List <CardTypeInfo>();
            DataSet objDataSet = new DataSet();

            try
            {
                //Itsp2WebServiceNamespace.Itsp2WebService objItsp2WebService = new Itsp2WebServiceNamespace.Itsp2WebService();
                //string strReturnXml = objItsp2WebService.GetCarType();

                string strReturnXml = ServiceWrapper.Current.GetCarType();

                objDataSet = Helper.FormatConvert.XmlToDataSet(strReturnXml);
            }
            catch (Exception e)
            {
                _objSystemMessageInfo           = _objSystemMessage.GetInfoByCode("WebServiceConnectFail");
                _objSystemMessageInfo.Success   = false;
                _objSystemMessageInfo.Exception = e.Message;
                return(null);
            }

            try
            {
                if (objDataSet.Tables.Count > 0)
                {
                    foreach (DataRow objDataRow in objDataSet.Tables[0].Rows)
                    {
                        CardTypeInfo objCardTypeInfo = GetInfoFromDataRow(objDataRow);
                        objIListCardTypeInfo.Add(objCardTypeInfo);
                    }
                }
            }
            catch (Exception e)
            {
                _objSystemMessageInfo           = _objSystemMessage.GetInfoByCode("WebServiceParseToInfoFail");
                _objSystemMessageInfo.Success   = false;
                _objSystemMessageInfo.Exception = e.Message;
                return(null);
            }

            theSystemMessageInfo = _objSystemMessageInfo;
            return(objIListCardTypeInfo);
        }
Example #10
0
        public IList <CardInfo> SearchByCondition(Hashtable theHashtable, DataAccessor theDataAccessor, int Size, int BeginSize, string strOrderBy, ref SystemMessageInfo theSystemMessageInfo)
        {
            SystemMessage     _objSystemMessage     = new SystemMessage();
            SystemMessageInfo _objSystemMessageInfo = new SystemMessageInfo();

            IList <CardInfo> objIListCardTypeInfo = new List <CardInfo>();
            XmlDocument      objXmlDocument       = Helper.FormatConvert.HashtableToXml(theHashtable);

            DataSet objDataSet = new DataSet();

            try
            {
                string[] strReturnXml = ServiceWrapper.Current.SelectCardInfoByCondition(objXmlDocument.OuterXml, Size, BeginSize, strOrderBy);

                CurrentUser.Current.TotalCount = Int32.Parse(strReturnXml[0].ToString());

                objDataSet = Helper.FormatConvert.XmlToDataSet(strReturnXml[1]);
                try
                {
                    if (objDataSet.Tables.Count > 0)
                    {
                        foreach (DataRow objDataRow in objDataSet.Tables[0].Rows)
                        {
                            CardInfo objCardTypeInfo = GetInfoFromDataRow(objDataRow);
                            objIListCardTypeInfo.Add(objCardTypeInfo);
                        }
                    }
                }
                catch (Exception e)
                {
                    _objSystemMessageInfo           = _objSystemMessage.GetInfoByCode("WebServiceParseToInfoFail");
                    _objSystemMessageInfo.Success   = false;
                    _objSystemMessageInfo.Exception = e.Message;
                }
            }
            catch (Exception e)
            {
                _objSystemMessageInfo           = _objSystemMessage.GetInfoByCode("WebServiceConnectFail");
                _objSystemMessageInfo.Success   = false;
                _objSystemMessageInfo.Exception = e.Message;
            }

            theSystemMessageInfo = _objSystemMessageInfo;
            return(objIListCardTypeInfo);
        }
        public ActionResult Edit(SystemMessageInfoModel model)
        {
            if (ModelState.IsValid)
            {
                SystemMessageInfo info = service.GetById(model.Id);

                info.Title = model.Title;

                info.Content = model.Content;

                service.Update(info);
                return(Json(new AjaxResult()
                {
                    Result = Result.Success
                }));
            }
            return(View(PluginHelper.GetViewPath(this.GetType(), "Edit"), model));
        }
        public ActionResult Create(SystemMessageInfoModel model)
        {
            if (ModelState.IsValid)
            {
                SystemMessageInfo info = new SystemMessageInfo();
                info.Id = Guid.NewGuid();

                info.Title = model.Title;

                info.Content = model.Content;

                service.Add(info);
                return(Json(new AjaxResult()
                {
                    Result = Result.Success
                }));
            }
            return(View(PluginHelper.GetViewPath(this.GetType(), "Create"), model));
        }
Example #13
0
        public SystemMessageInfo Delete(Guid theId, DataAccessor theDataAccessor)
        {
            SystemMessage     _objSystemMessage     = new SystemMessage();
            SystemMessageInfo _objSystemMessageInfo = new SystemMessageInfo();

            if (theId == SystemConstant.GuidEmpty)
            {
                return(null);
            }

            //调用WebService,把theCardTypeInfo转成Hashtable再转成Xml以便调用
            //Hashtable objHashtable = new Hashtable();
            //objHashtable.Add("id", theId);
            //这里的后台写法仅支持传一个对象删除的方法
            CardTypeInfo objCardTypeInfoCondition = new CardTypeInfo();

            objCardTypeInfoCondition.Id = theId;
            Hashtable   objHashtable   = InfoToHashtable(objCardTypeInfoCondition);
            XmlDocument objXmlDocument = Helper.FormatConvert.HashtableToXml(objHashtable);

            try
            {
                //Itsp2WebServiceNamespace.Itsp2WebService objItsp2WebService = new Itsp2WebServiceNamespace.Itsp2WebService();
                //objItsp2WebService.UpdateCardTypeByCondition(objXmlDocument.OuterXml);
                ServiceWrapper.Current.UpdateCardTypeByCondition(objXmlDocument.OuterXml);
            }
            catch (Exception e)
            {
                _objSystemMessageInfo           = _objSystemMessage.GetInfoByCode("WebServiceConnectFail");
                _objSystemMessageInfo.Success   = false;
                _objSystemMessageInfo.Exception = e.Message;
                return(_objSystemMessageInfo);
            }

            _objSystemMessageInfo = _objSystemMessage.GetInfoByCode("DataDeleteSucceeded");
            return(_objSystemMessageInfo);
        }
 public IList <CardTypeInfo> SearchAll(DataAccessor theDataAccessor, ref SystemMessageInfo theSystemMessageInfo)
 {
     return(_objICardTypeDAL.SearchAll(theDataAccessor, ref theSystemMessageInfo));
 }
 public CardTypeInfo GetById(Guid theId, DataAccessor theDataAccessor, ref SystemMessageInfo theSystemMessageInfo)
 {
     return(_objICardTypeDAL.GetById(theId, theDataAccessor, ref theSystemMessageInfo));
 }
 public IList <CardTypeInfo> SearchByCondition(Hashtable theHashtable, string OrderBy, DataAccessor theDataAccessor, int Size, int BeginSize, ref SystemMessageInfo theSystemMessageInfo)
 {
     return(_objICardTypeDAL.SearchByCondition(theHashtable, OrderBy, theDataAccessor, Size, BeginSize, ref theSystemMessageInfo));
 }
 private bool IsRightByUserIdRightInfoListRightCode(Guid theUserId, IList <RightInfo> theRightInfoList, string theRightCode, DataAccessor theDataAccessor, ref SystemMessageInfo theSystemMessageInfo)
 {
     return(_objILoginDAL.IsRightByUserIdRightInfoListRightCode(theUserId, theRightInfoList, theRightCode, theDataAccessor, ref theSystemMessageInfo));
 }
 public bool IsRightByUserIdRightInfoListRightCode(string theRightCode, DataAccessor theDataAccessor, ref SystemMessageInfo theSystemMessageInfo)
 {
     return(_objILoginDAL.IsRightByUserIdRightInfoListRightCode(CurrentUser.Current.UserId, (List <RightInfo>)CurrentUser.Current.RightInfoList, theRightCode, theDataAccessor, ref theSystemMessageInfo));
 }
        /// <summary>
        /// 执行后台换卡操作
        /// </summary>
        /// <param name="_cardInfo">卡信息对象</param>
        /// <param name="key">密码</param>
        /// <param name="isAdd"></param>
        /// <returns></returns>
        public string ChangeCardInitAndBack(Hashtable _cardInfo, Hashtable htCardInfo, DataAccessor theDataAccessor, ref SystemMessageInfo _info)
        {
            //string InitParameter, string HistoryParameter, string ResetCardParameter
            //调用WebService,把theCardTypeInfo转成Hashtable再转成Xml以便调用
            //Hashtable objHashtable = _objICardInfoDAL.InfoToHashtable(_cardInfo);

            //封装初始化需要用到的参数
            XmlDocument objXmlDocument = Helper.FormatConvert.HashtableToXml(_cardInfo);
            string      InitParameter  = HelperClass.EncryptDESByKey8(objXmlDocument.OuterXml);

            //封装需要记录的卡历史数据
            Dictionary <string, object> arr = new Dictionary <string, object>();

            //执行数据库存放
            arr["ICode"]          = "ITSP2_RFID_CS_CarHistoryInsert";
            arr["IVer"]           = "1.0.0.1";
            arr["saas_id"]        = htCardInfo["saas_id"];
            arr["operation_type"] = htCardInfo["operation_type_init"].ToString();  //初始化
            arr["card_id"]        = htCardInfo["card_id"];
            arr["no"]             = htCardInfo["no"];
            arr["address_type"]   = htCardInfo["address_type"];
            arr["network_id"]     = htCardInfo["network_id"];
            arr["operation_memo"] = htCardInfo["operation_memo_init"].ToString(); //操作事项
            arr["operation_user"] = htCardInfo["operation_user"];
            arr["card_cost_type"] = htCardInfo["cost_type"];                      //当前充值卡的扣费类型
            arr["volume"]         = htCardInfo["volume"];

            DataTable table = ConvertMethod.getDateTable("msgTable", arr);
            DataRow   dr    = table.NewRow();

            dr["ICode"]          = "ITSP2_RFID_CS_CarHistoryInsert";
            dr["IVer"]           = "1.0.0.1";
            dr["saas_id"]        = htCardInfo["saas_id"];
            dr["operation_type"] = htCardInfo["operation_type_payment"].ToString(); //初始化
            dr["card_id"]        = htCardInfo["card_id"];
            dr["no"]             = htCardInfo["no"];
            dr["address_type"]   = htCardInfo["address_type"];
            dr["network_id"]     = htCardInfo["network_id"];
            dr["operation_memo"] = htCardInfo["operation_memo_payment"].ToString(); //操作事项
            dr["operation_user"] = htCardInfo["operation_user"];
            dr["card_cost_type"] = htCardInfo["cost_type"];                         //当前充值卡的扣费类型
            dr["volume"]         = htCardInfo["volume"];

            table.Rows.Add(dr);
            string HistoryParameter = ConvertMethod.CDataToXml(table);

            //加密xml进行返回
            HistoryParameter = HelperClass.EncryptDESByKey8(HistoryParameter);

            string resoue = _objICardInfoDAL.UpdateCarInfoAndChangeCardHistoryRecord(InitParameter, HistoryParameter);

            //先解密成xml格式
            string str = HelperClass.DecryptDESByKey8(resoue);
            //把字符串转换成表对象
            DataSet parameterTable = ConvertMethod.CXmlToDataSet(str);

            //直接返回操作结果
            return(parameterTable.Tables[0].Rows[0]["msgCode"].ToString());
        }
 /// <summary>
 /// 根据SAASID跟用户账户密码查询该C/S用户是否存在
 /// </summary>
 /// <param name="theHashtable"></param>
 /// <param name="theDataAccessor"></param>
 /// <param name="theSystemMessageInfo"></param>
 /// <returns></returns>
 public UserInfo SelectUserCountByID(Dictionary <string, object> arr, DataAccessor theDataAccessor, ref SystemMessageInfo theSystemMessageInfo)
 {
     return(_objILoginDAL.SelectUserCountByID(arr, theDataAccessor, ref theSystemMessageInfo));
 }
Example #21
0
 public IList <HistoryInfo> SearchByCondition(Hashtable theHashtable, string strOrderBy, int Size, int BeginSize, DataAccessor theDataAccessor, ref SystemMessageInfo theSystemMessageInfo)
 {
     return(_objIHistoryDAL.SearchByCondition(theHashtable, strOrderBy, Size, BeginSize, theDataAccessor, ref theSystemMessageInfo));
 }
Example #22
0
        public async Task <MessageDto> CreateMessageAsync(ConversationType conversationType, long conversationId, SystemMessageInfo systemMessageInfo)
        {
            List <long> nodesIds = await conversationsService.GetConversationNodesIdsAsync(conversationType, conversationId).ConfigureAwait(false);

            using (MessengerDbContext context = contextFactory.Create())
            {
                var           messageInfoJson = systemMessageInfo.ToJson();
                AttachmentDto attachmentDto   = new AttachmentDto
                {
                    Type    = AttachmentType.SystemMessage,
                    Payload = messageInfoJson,
                    Hash    = GetHash(messageInfoJson)
                };
                MessageDto messageDto = new MessageDto
                {
                    ConversationId   = conversationId,
                    ConversationType = conversationType,
                    Attachments      = new List <AttachmentDto>
                    {
                        attachmentDto
                    },
                    SendingTime = DateTime.UtcNow.ToUnixTime(),
                    GlobalId    = Guid.NewGuid(),
                    NodesIds    = nodesIds
                };
                Message message = MessageConverter.GetMessage(messageDto);
                if (conversationType == ConversationType.Dialog)
                {
                    var mirrorMessage  = (MessageDto)messageDto.Clone();
                    var mirrodDialogId = await loadDialogsService.GetMirrorDialogIdAsync(conversationId);

                    mirrorMessage.ConversationId = mirrodDialogId;
                    await context.Messages.AddAsync(MessageConverter.GetMessage(mirrorMessage));
                }
                await context.Messages.AddAsync(message).ConfigureAwait(false);

                await context.SaveChangesAsync().ConfigureAwait(false);

                return(MessageConverter.GetMessageDto(message));
            }
        }
Example #23
0
 public void Delete(SystemMessageInfo info)
 {
     repository.Delete(info);
 }
Example #24
0
 public IList <HistoryInfo> SearchByCondition(Dictionary <string, object> arr, DataAccessor theDataAccessor, ref SystemMessageInfo theSystemMessageInfo)
 {
     return(_objIHistoryDAL.SearchByCondition(arr, theDataAccessor, ref theSystemMessageInfo));
 }
Example #25
0
        public void Update(SystemMessageInfo info)
        {
            var query = repository.Table;

            repository.Update(info);
        }
Example #26
0
        public void Add(SystemMessageInfo info)
        {
            var query = repository.Table;

            repository.Insert(info);
        }
        /// <summary>
        /// 执行后台初始化
        /// </summary>
        /// <param name="_cardInfo">卡信息对象</param>
        /// <param name="key">密码</param>
        /// <param name="isAdd"></param>
        /// <returns></returns>
        public string InsertCardInfo(Hashtable _cardInfo, Hashtable htCardInfo, DataAccessor theDataAccessor, ref SystemMessageInfo _info)
        {
            //调用WebService,把theCardTypeInfo转成Hashtable再转成Xml以便调用
            //Hashtable objHashtable = _objICardInfoDAL.InfoToHashtable(_cardInfo);
            XmlDocument objXmlDocument = Helper.FormatConvert.HashtableToXml(_cardInfo);
            string      message        = _objICardInfoDAL.InsertCardInfo(HelperClass.EncryptDESByKey8(objXmlDocument.OuterXml));

            Dictionary <string, object> arr = new Dictionary <string, object>();
            string resoue = SystemConstant.StringEmpty;

            if (_cardInfo["status"] != null)
            {
                int length = _cardInfo["status"].Equals(CardTypeInfo.CardTypeInfoDefaultCardStatus.已初始化.ToString("D")) ? 1 : 2;
                for (int i = 0; i < length; i++)
                {
                    //执行数据库存放
                    arr["ICode"]          = "ITSP2_RFID_CS_CarHistoryInsert";
                    arr["IVer"]           = "1.0.0.1";
                    arr["saas_id"]        = htCardInfo["saas_id"];
                    arr["operation_type"] = (i == 0 ? htCardInfo["operation_type_init"].ToString() : htCardInfo["operation_type_payment"].ToString()); //初始化
                    arr["card_id"]        = htCardInfo["card_id"];
                    arr["no"]             = htCardInfo["no"];
                    arr["address_type"]   = htCardInfo["address_type"];
                    arr["network_id"]     = htCardInfo["network_id"];
                    arr["operation_memo"] = (i == 0 ? htCardInfo["operation_memo_init"].ToString() : htCardInfo["operation_memo_payment"].ToString()); //操作事项
                    arr["operation_user"] = htCardInfo["operation_user"];
                    arr["card_cost_type"] = htCardInfo["cost_type"];                                                                                   //当前充值卡的扣费类型
                    arr["volume"]         = htCardInfo["volume"];

                    DataTable table     = ConvertMethod.getDateTable("msgTable", arr);
                    string    Parameter = ConvertMethod.CDataToXml(table);

                    //加密xml进行返回
                    Parameter = HelperClass.EncryptDESByKey8(Parameter);
                    resoue    = _objICardInfoDAL.InsertCarInformationHistoryRecord(Parameter);
                }
            }
            //先解密成xml格式
            string str = HelperClass.DecryptDESByKey8(resoue);
            //把字符串转换成表对象
            DataSet parameterTable = ConvertMethod.CXmlToDataSet(str);

            if (parameterTable.Tables[0].Rows[0]["msgCode"].ToString() == "充值数据成功!")
            {
                return(message); //未实现,默认全部成功
            }
            else
            {
                return("99");
            }
        }
Example #28
0
        public bool IsRightByUserIdRightInfoListRightCode(Guid theUserId, IList <RightInfo> theRightInfoList, string theRightCode, DataAccessor theDataAccessor, ref SystemMessageInfo theSystemMessageInfo)
        {
            bool bolReturn = false;

            foreach (RightInfo objRightInfo in theRightInfoList)
            {
                if (objRightInfo.UserId == theUserId && objRightInfo.Code == theRightCode)
                {
                    return(true);
                }
            }
            return(bolReturn);
        }
Example #29
0
        /// <summary>
        /// 根据SAASID跟用户账户密码查询该C/S用户是否存在
        /// </summary>
        /// <param name="theHashtable"></param>
        /// <param name="theDataAccessor"></param>
        /// <param name="theSystemMessageInfo"></param>
        /// <returns></returns>
        public UserInfo SelectUserCountByID(Dictionary <string, object> arr, DataAccessor theDataAccessor, ref SystemMessageInfo theSystemMessageInfo)
        {
            SystemMessage     _objSystemMessage     = new SystemMessage();
            SystemMessageInfo _objSystemMessageInfo = new SystemMessageInfo();

            UserInfo objUserInfo = new UserInfo();

            //转换为Datatable
            DataTable dt = ConvertMethod.getDateTable("table", arr);
            //dataTable转换为XML
            string objXmlDocument = Helper.ConvertMethod.CDataToXml(dt);

            ////加密xml进行返回
            string Parameter = ConvertMethod.EncryptDESByKey8(objXmlDocument, ConfigurationSettings.AppSettings["password"]);

            DataSet objDataSet = new DataSet();

            try
            {
                string strReturnXml = ServiceWrapper.Current.ClientUserAuthentication(Parameter);

                //先解密成xml格式
                strReturnXml = ConvertMethod.DecryptDESByKey8(strReturnXml, ConfigurationSettings.AppSettings["password"]);

                objDataSet = Helper.FormatConvert.CXmlToDataSet(strReturnXml);
                try
                {
                    if (objDataSet.Tables.Count > 1)
                    {
                        foreach (DataRow objDataRow in objDataSet.Tables["tb_user"].Rows)
                        {
                            objUserInfo = GetInfoFromDataRow(objDataRow);
                        }
                    }
                    if (objDataSet.Tables.Count == 3)
                    {
                        objUserInfo.IsPower = true;
                        foreach (DataRow objDataRow in objDataSet.Tables["tb_right"].Rows)
                        {
                            //解析权限 2012.01.04 zhangwenjin add
                            objUserInfo.RightInfoList.Add(GetRightInfoFromDataRow(objDataRow));
                        }
                    }
                    if (objDataSet.Tables.Count == 1)
                    {
                        return(null);
                    }
                }
                catch (Exception e)
                {
                    _objSystemMessageInfo           = _objSystemMessage.GetInfoByCode("WebServiceParseToInfoFail");
                    _objSystemMessageInfo.Success   = false;
                    _objSystemMessageInfo.Exception = e.Message;
                }
            }
            catch (Exception e)
            {
                _objSystemMessageInfo           = _objSystemMessage.GetInfoByCode("WebServiceConnectFail");
                _objSystemMessageInfo.Success   = false;
                _objSystemMessageInfo.Exception = e.Message;
            }

            theSystemMessageInfo = _objSystemMessageInfo;
            return(objUserInfo);
        }