Beispiel #1
0
        private void BtnReturnBook_Click(object sender, EventArgs e)
        {
            try
            {
                Iss iss = new Iss();
                iss.IssBookId    = Convert.ToInt32(this.tbReturnBookId.Text.Trim());
                iss.IssBookName  = this.tbReturnBookName.Text.Trim();
                iss.IssUserId    = Convert.ToInt32(this.tbReturnUserId.Text.Trim());
                iss.IssBeginTime = Convert.ToDateTime(this.dtpBeginTime.Text.Trim());
                iss.IssEndTime   = Convert.ToString(this.dtpReturnEndTime.Text.Trim());
                iss.IssStatus    = "已归还";
                iss.IssId        = Convert.ToInt32(this.tbIssId.Text.Trim());

                int ret = new IssManager().UpdateIss(iss);
                if (ret > 0)
                {
                    MessageBox.Show(RETURNSUCCEED, OPERATIONWARN, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    IssDataBind();
                }
                else
                {
                    MessageBox.Show(RETURNFAILED, OPERATIONWARN, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, OPERATIONFAILSED, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #2
0
        private void BtnBorrowSub_Click(object sender, EventArgs e)
        {
            try
            {
                Iss iss = new Iss();
                iss.IssBookId   = Convert.ToInt32(this.tbBorrowBId.Text.Trim());
                iss.IssBookName = this.tbBorrowBName.Text.Trim();
                //iss.IssUserId = Convert.ToInt32(formLogin.GetLoginId);
                iss.IssUserId    = Convert.ToInt32(this.tbBorrowSId.Text.Trim());
                iss.IssBeginTime = Convert.ToDateTime(this.timeBorrow.Text.Trim());
                iss.IssStatus    = "未归还";

                int ret = new IssManager().AddIss(iss);
                if (ret > 0)
                {
                    MessageBox.Show(BORROWSUCCEED, OPERATIONWARN, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show(BORROWFAILED, OPERATIONWARN, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, OPERATIONFAILSED, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #3
0
 public int UpdateIss(Iss iss)
 {
     try
     {
         return(issService.UpdateIss(iss));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public static void Imposto()
        {
            var iss  = new Iss();
            var icms = new Icms();
            var iccc = new Iccc();

            var orcamento = new Orcamento(4000);

            CalculadorDeImposto.RealizaCalculo(orcamento, iss);
            CalculadorDeImposto.RealizaCalculo(orcamento, icms);
            CalculadorDeImposto.RealizaCalculo(orcamento, iccc);
        }
        public String ToJSONString()
        {
            var phStr   = "PH: " + Iph.ToString("F5");
            var doStr   = "DO: " + Ido.ToString("F5");
            var bod5Str = "BOD5: " + Ibod5.ToString("F5");
            var codStr  = "COD: " + Icod.ToString("F5");
            var nh4nStr = "NH4-N: " + Inh4n.ToString("F5");
            var no2nStr = "NO2-N: " + Ino2n.ToString("F5");
            var no3nStr = "NO3-N: " + Ino3n.ToString("F5");
            var ssStr   = "SS: " + Iss.ToString("F5");
            var clStr   = "CL: " + Icl.ToString("F5");
            var cbStr   = "CB: " + Icb.ToString("F5");

            return(phStr + ", " + doStr + ", " + bod5Str + ", " + codStr + ", " + nh4nStr + ", " + no2nStr + ", " + no3nStr + ", " + ssStr + ", " + clStr + ", " + cbStr);
        }
Beispiel #6
0
        public ExemploIcmsIss()
        {
            Console.WriteLine("Exemplo de ICMS e ISS");

            IImposto icms = new Icms();
            IImposto iss  = new Iss();

            Orcamento orcamento = new Orcamento();

            orcamento.AdicionarItem(new Item("Microondas", 500.00));

            CalculadorDeImpostos calculador = new CalculadorDeImpostos();

            calculador.RealizarCalculo(orcamento, icms);
            calculador.RealizarCalculo(orcamento, iss);
        }
Beispiel #7
0
        public static void StrategyCalcImpostos()
        {
            IImposto icms = new Icms();
            IImposto iss  = new Iss();
            IImposto iccc = new ICCC();

            Orcamento            orcamento  = new Orcamento(2000d);
            CalculadorDeImpostos calculador = new CalculadorDeImpostos();

            calculador.RealizaCalculo(orcamento, icms)
            .RealizaCalculo(orcamento, iss)
            .RealizaCalculo(orcamento, iccc);

            Console.WriteLine("Impostos sobre o orcamento!" + calculador.ValorCalculado);
            Console.WriteLine("VAlor Final = " + (orcamento.Valor + calculador.ValorCalculado));
            Console.ReadKey();
        }
Beispiel #8
0
        //根据读者id查询
        public List <Iss> GetIssByUserId(string issUserId)
        {
            List <Iss> isses = new List <Iss>();
            //sql语句
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("select * from Iss");
            sb.AppendLine("where issUserId = @issUserId");
            sb.AppendLine("order by issStatus,issEndTime desc");
            //参数
            SqlParameter[] paras =
            {
                new SqlParameter("@issUserId", issUserId)
            };
            //创建连接对象
            SqlConnection conn = new SqlConnection(connString);

            try
            {
                //创建执行工具
                SqlCommand cmd = new SqlCommand(sb.ToString(), conn);
                cmd.Parameters.AddRange(paras);
                //执行
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                //判断
                while (reader.Read())
                {
                    Iss iss = new Iss();
                    iss.IssId        = Convert.ToInt32(reader["IssId"]);
                    iss.IssStatus    = Convert.ToString(reader["IssStatus"]);
                    iss.IssBookId    = Convert.ToInt32(reader["IssBookId"]);
                    iss.IssBookName  = Convert.ToString(reader["IssBookName"]);
                    iss.IssUserId    = Convert.ToInt32(reader["IssUserId"]);
                    iss.IssBeginTime = Convert.ToDateTime(reader["IssBeginTime"]);
                    iss.IssEndTime   = Convert.ToString(reader["IssEndTime"]);
                    isses.Add(iss);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(isses);
        }
Beispiel #9
0
        //增加借阅
        public int AddIss(Iss iss)
        {
            //DateTime dateTime = new DateTime(3000, 01, 01);
            //sql语句
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("insert into Iss");
            sb.AppendLine("values(@issBookId,@issBookName,@issUserId,@issBeginTime,@issEndTime,@issStatus)");
            //变量赋值,设置参数
            SqlParameter[] paras =
            {
                //new SqlParameter("@issId",iss.IssId),
                new SqlParameter("@issBookId",    iss.IssBookId),
                new SqlParameter("@issBookName",  iss.IssBookName),
                new SqlParameter("@issUserId",    iss.IssUserId),
                new SqlParameter("@issBeginTime", iss.IssBeginTime),
                new SqlParameter("@issEndTime",   iss.IssEndTime),
                new SqlParameter("@issStatus",    iss.IssStatus)
            };
            //创建连接对象
            SqlConnection conn = new SqlConnection(connString);

            try
            {
                //创建执行工具
                SqlCommand cmd = new SqlCommand(sb.ToString(), conn);
                //设置执行工具的参数
                cmd.Parameters.AddRange(paras);
                conn.Open();
                //执行
                int result = cmd.ExecuteNonQuery();
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            //关闭数据库
            finally
            {
                conn.Close();
            }
        }
Beispiel #10
0
        public static Journal asd( )
        {
            var assembly = Assembly.GetExecutingAssembly( );
            var stream   = assembly.GetManifestResourceStream(@"Our4LegendData.xml");

            if (stream == null)
            {
                throw new Exception( );
            }
            var Reader = new StreamReader(stream);

            var Doc = XDocument.Parse(Reader.ReadToEnd( ));

            var journal = (from Jou in Doc.Descendants("Journal")
                           select new Journal
            {
                Name = ( string )Jou.Attribute("Name"),

                ListOfIssue = from Iss in Jou.Descendants("Issue")
                              select new Issue
                {
                    Number = ( long )Iss.Attribute("Number"),
                    PublishTime = Convert.ToDateTime(Iss.Attribute("PublishTime")),
                    Price = ( decimal )Iss.Attribute("Price"),
                    ListOfArticle = from Art in Iss.Descendants("Article")
                                    select new Article
                    {
                        Title = ( string )Art.Attribute("Title"),
                        Text = ( string )Art.Attribute("Text"),
                        ListOfAuthor = from Aut in Art.Descendants("Author")
                                       select new Author
                        {
                            FirstName = ( string )Aut.Attribute("FirstName"),
                            FamilyName = ( string )Aut.Attribute("FamilyName"),
                            EmailAddress = ( string )Aut.Attribute("EmailAddress")
                        }
                    }
                }
            }).FirstOrDefault( );

            return(journal);
        }
        public PowerShellEngine(PowerShellOptions options, ILogger logger)
        {
            _options = options;
            _logger  = logger;
            Iss      = InitialSessionState.CreateDefault2();

            // Preload all cmdlets from this assembly
            Assembly core = Assembly.GetExecutingAssembly();

            Iss.LoadCmdlets(core);

            // FOR CORE:
            // Fix the PSModulePath, because now we're a full-blown host and ship with our own modules
            // TODO: What should this default be?
            var oldPath      = Environment.GetEnvironmentVariable("PSModulePath", EnvironmentVariableTarget.Process) ?? "";
            var localModules = Path.Combine(Path.GetDirectoryName(core.Location), "Modules");
            var newPath      = string.Join(Path.PathSeparator, oldPath.Split(Path.PathSeparator).Append(localModules).Distinct());

            Environment.SetEnvironmentVariable("PSModulePath", newPath, EnvironmentVariableTarget.Process);

            // We may want to use a runspace pool? ps.RunspacePool = rsp;
            Runspace = RunspaceFactory.CreateRunspace(Iss);
            Runspace.Open();
        }
Beispiel #12
0
 public ActionResult <IssLocation> Get()
 {
     return(Iss.GetCurrentIssLocation());
 }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Iss != null)
         {
             hashCode = hashCode * 59 + Iss.GetHashCode();
         }
         if (Sub != null)
         {
             hashCode = hashCode * 59 + Sub.GetHashCode();
         }
         if (Aud != null)
         {
             hashCode = hashCode * 59 + Aud.GetHashCode();
         }
         if (Exp != null)
         {
             hashCode = hashCode * 59 + Exp.GetHashCode();
         }
         if (Nbf != null)
         {
             hashCode = hashCode * 59 + Nbf.GetHashCode();
         }
         if (Iat != null)
         {
             hashCode = hashCode * 59 + Iat.GetHashCode();
         }
         if (Jti != null)
         {
             hashCode = hashCode * 59 + Jti.GetHashCode();
         }
         if (Uuid != null)
         {
             hashCode = hashCode * 59 + Uuid.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (GivenName != null)
         {
             hashCode = hashCode * 59 + GivenName.GetHashCode();
         }
         if (Nickname != null)
         {
             hashCode = hashCode * 59 + Nickname.GetHashCode();
         }
         if (Email != null)
         {
             hashCode = hashCode * 59 + Email.GetHashCode();
         }
         if (EmailVerified != null)
         {
             hashCode = hashCode * 59 + EmailVerified.GetHashCode();
         }
         if (Zoneinfo != null)
         {
             hashCode = hashCode * 59 + Zoneinfo.GetHashCode();
         }
         if (Locale != null)
         {
             hashCode = hashCode * 59 + Locale.GetHashCode();
         }
         if (Cnf != null)
         {
             hashCode = hashCode * 59 + Cnf.GetHashCode();
         }
         if (Orig != null)
         {
             hashCode = hashCode * 59 + Orig.GetHashCode();
         }
         if (Dest != null)
         {
             hashCode = hashCode * 59 + Dest.GetHashCode();
         }
         if (Mky != null)
         {
             hashCode = hashCode * 59 + Mky.GetHashCode();
         }
         return(hashCode);
     }
 }
        /// <summary>
        /// Returns true if JWToken instances are equal
        /// </summary>
        /// <param name="other">Instance of JWToken to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(JWToken other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Iss == other.Iss ||
                     Iss != null &&
                     Iss.Equals(other.Iss)
                     ) &&
                 (
                     Sub == other.Sub ||
                     Sub != null &&
                     Sub.Equals(other.Sub)
                 ) &&
                 (
                     Aud == other.Aud ||
                     Aud != null &&
                     Aud.Equals(other.Aud)
                 ) &&
                 (
                     Exp == other.Exp ||
                     Exp != null &&
                     Exp.Equals(other.Exp)
                 ) &&
                 (
                     Nbf == other.Nbf ||
                     Nbf != null &&
                     Nbf.Equals(other.Nbf)
                 ) &&
                 (
                     Iat == other.Iat ||
                     Iat != null &&
                     Iat.Equals(other.Iat)
                 ) &&
                 (
                     Jti == other.Jti ||
                     Jti != null &&
                     Jti.Equals(other.Jti)
                 ) &&
                 (
                     Uuid == other.Uuid ||
                     Uuid != null &&
                     Uuid.Equals(other.Uuid)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     GivenName == other.GivenName ||
                     GivenName != null &&
                     GivenName.Equals(other.GivenName)
                 ) &&
                 (
                     Nickname == other.Nickname ||
                     Nickname != null &&
                     Nickname.Equals(other.Nickname)
                 ) &&
                 (
                     Email == other.Email ||
                     Email != null &&
                     Email.Equals(other.Email)
                 ) &&
                 (
                     EmailVerified == other.EmailVerified ||
                     EmailVerified != null &&
                     EmailVerified.Equals(other.EmailVerified)
                 ) &&
                 (
                     Zoneinfo == other.Zoneinfo ||
                     Zoneinfo != null &&
                     Zoneinfo.Equals(other.Zoneinfo)
                 ) &&
                 (
                     Locale == other.Locale ||
                     Locale != null &&
                     Locale.Equals(other.Locale)
                 ) &&
                 (
                     Cnf == other.Cnf ||
                     Cnf != null &&
                     Cnf.Equals(other.Cnf)
                 ) &&
                 (
                     Orig == other.Orig ||
                     Orig != null &&
                     Orig.Equals(other.Orig)
                 ) &&
                 (
                     Dest == other.Dest ||
                     Dest != null &&
                     Dest.Equals(other.Dest)
                 ) &&
                 (
                     Mky == other.Mky ||
                     Mky != null &&
                     Mky.Equals(other.Mky)
                 ));
        }
        public static Journal GetJournal(IRandomAccessStream stream)
        {
            if (stream == null)
            {
                return(null);
            }
            else
            {
                var Reader = new StreamReader(stream.AsStream());

                var Doc = XDocument.Parse(Reader.ReadToEnd());

                Journal journal;
                try
                {
                    journal = (from Jou in Doc.Descendants("Journal")
                               select new Journal
                    {
                        Name = ( string )Jou.Attribute("Name"),
                        ListOfAuthor = from Aut in Jou.Descendants("Author")
                                       select new Author
                        {
                            FirstName = ( string )Aut.Attribute("FirstName"),
                            FamilyName = ( string )Aut.Attribute("FamilyName"),
                            EmailAddress = ( string )Aut.Attribute("EmailAddress"),
                            Introduction = ( string )Aut.Attribute("Introduction")
                        },
                        ListOfIssue = from Iss in Jou.Descendants("Issue")
                                      select new Issue
                        {
                            Number = ( long )Iss.Attribute("Number"),
                            PublishTime = Convert.ToDateTime(( string )Iss.Attribute("PublishTime")),
                            Price = ( decimal )Iss.Attribute("Price"),
                            ListOfArticle = from Art in Iss.Descendants("Article")
                                            select new Article
                            {
                                Title = ( string )Art.Attribute("Title"),
                                TextLine = from Lin in Art.Descendants("Text").FirstOrDefault().Descendants("Line")
                                           select(string) Lin.Attribute("Run"),
                                ListOfAuthorName = from Aut in Art.Descendants("AuthorName")
                                                   select(string) Aut.Attribute("FirstName") + " " + ( string )Aut.Attribute("FamilyName"),
                            }
                        }
                    }).First();
                }
                catch (System.Exception)
                {
                    return(null);
                }
                foreach (var Aut in journal.ListOfAuthor)
                {
                    foreach (var Iss in journal.ListOfIssue)
                    {
                        foreach (var Art in Iss.ListOfArticle)
                        {
                            foreach (var aut in Art.ListOfAuthor)
                            {
                                if (Aut == aut)
                                {
                                    Aut.ArticleHaveContribute.Add(Art);
                                }
                            }
                        }
                    }
                }
                return(journal);
            }
        }