public void CallServiceBDSD(object obj)
        {
            string tranid = "";

            try
            {
                ModelCallService   input  = (ModelCallService)obj;
                VB2B_SMSSoapClient client = new VB2B_SMSSoapClient();

                SMSRQ model = new SMSRQ()
                {
                    HEADER = new HEADERRQ()
                    {
                        SOURCE    = "HUNGTHINH",
                        DEST      = "VIETINBANK",
                        TRANSID   = DateTime.Now.ToString("yyyyMMddHHmmss") + new Random().Next(0, 9999).ToString("0000"),
                        TRANSTIME = DateTime.Now.ToString("yyyyMMddHHmmss"),
                        USER      = ConfigType.HungThinhUser,
                        PWD       = ConfigType.HungThinhPassword
                    },
                    DATA = new DATARQ()
                    {
                        NOSMS   = input.NOSMS.ToString(),
                        SMSLIST = input.SMSLIST
                    }
                };
                tranid = model.HEADER.TRANSID;
                string             xmlreq   = ConvertXML.ModelToXMLString <SMSRQ>(model);
                LogCallVTBProvider provider = new LogCallVTBProvider();
                LogCallVTB         logModel = new LogCallVTB()
                {
                    Request = xmlreq,
                };
                xmlreq = HttpUtility.HtmlEncode(xmlreq);
                //logger.Info("Start CallServiceBDSD");
                logModel.Response = HttpUtility.HtmlDecode(client.ReceiveMTResBDSD(xmlreq));
                //logger.Info("End CallServiceBDSD");
                provider.Insert(logModel);
                logger.Info(string.Format("CallVTB: {0} | {1}", logModel.Request, logModel.Response));
            }
            catch (Exception ex)
            {
                logger.Error("tranid : " + tranid, ex);
                logger.Error(ex);
                Thread.Sleep(60000);
                CallServiceBDSD(obj);
            }
        }
        public string SendMT(string xmlreq)
        {
            logger.Info("xmlreq befor:" + xmlreq);
            xmlreq = Server.HtmlDecode(xmlreq);
            logger.Info("xmlreq after:" + xmlreq);
            SMSRS response = new SMSRS();

            try
            {
                SMSRQ request = ConvertXML.XMLToModel <SMSRQ>(xmlreq);
                response.HEADER = new HEADERRES()
                {
                    DEST      = request.HEADER.DEST,
                    PWD       = request.HEADER.PWD,
                    SOURCE    = request.HEADER.SOURCE,
                    TRANSID   = request.HEADER.TRANSID,
                    TRANSTIME = request.HEADER.TRANSTIME,
                    USER      = request.HEADER.USER,
                };
                if (ValidateUser.CheckUser(request.HEADER.USER, request.HEADER.PWD))
                {
                    DateTime             transTime = DateTime.ParseExact(request.HEADER.TRANSTIME, "yyyyMMddHHmmss", null);
                    QueueServiceProvider provider  = new QueueServiceProvider();
                    EncryptAndDecrypt    ead       = new EncryptAndDecrypt();
                    foreach (var item in request.DATA.SMS)
                    {
                        QueueService model = new QueueService()
                        {
                            Content        = item.CONTENT,
                            Dest           = request.HEADER.DEST,
                            Password       = request.HEADER.PWD,
                            Priority       = item.PRIORITY,
                            ProcessingCode = item.PROCESSINGCODE,
                            Receiver       = item.RECEIVER,
                            Source         = request.HEADER.SOURCE,
                            TransID        = request.HEADER.TRANSID,
                            TransTime      = transTime,
                            DateCreate     = DateTime.Now,
                            User           = request.HEADER.USER,
                            SMSID          = item.SMSID
                        };
                        provider.Insert(model);
                    }
                    response.DATA = new DATARES()
                    {
                        ERROR = new ERRORRES()
                        {
                            ERRCODE = ConfigType.RS_SUCCESS,
                            ERRDESC = ConfigType.RS_SUCCESS_MESS
                        }
                    };
                }
                else
                {
                    response.DATA = new DATARES()
                    {
                        ERROR = new ERRORRES()
                        {
                            ERRCODE = ConfigType.RS_PASSWORD_FAIL,
                            ERRDESC = ConfigType.RS_PASSWORD_FAIL_MESS
                        }
                    };
                }
            }
            catch (Exception ex)
            {
                response.DATA = new DATARES()
                {
                    ERROR = new ERRORRES()
                    {
                        ERRCODE = ConfigType.RS_SYSTEM_ERROR,
                        ERRDESC = ConfigType.RS_SYSTEM_ERROR_MESS
                    }
                };
                logger.Error(ex);
            }
            string responseXML = ConvertXML.ModelToXMLString <SMSRS>(response);

            logger.Info("Response: " + responseXML);
            //ResultModel result = new ResultModel()
            //{
            //    xmlres = Server.UrlEncode(responseXML),
            //};
            //return result;
            return(Server.HtmlEncode(responseXML));
        }