示例#1
1
		public Int16 Insert(ParkingRateDetails Details)
		{
			try 
			{
                Details.CreatedByName = Details.ParkingRateID == 0 ? Details.CreatedByName : Details.LastUpdatedByName;

                Save(Details);

                string SQL = "SELECT LAST_INSERT_ID();";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                System.Data.DataTable dt = new System.Data.DataTable("LAST_INSERT_ID");
                base.MySqlDataAdapterFill(cmd, dt);
                

                Int16 iID = 0;
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    iID = Int16.Parse(dr[0].ToString());
                }

				return iID;
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
示例#2
0
        public void bindgrid()
        {
            System.Data.DataTable dt = new System.Data.DataTable();

            if (OboutDropDownList1.SelectedValue == "Clients")
            {
                dt = Functions.DB.GetCustomers();
            }
            else if (OboutDropDownList1.SelectedValue == "Sales Reps")
            {
                dt = Functions.DB.GetSalesReps();
            }

            Grid1.DataSource = dt;
            Grid1.DataBind();
            string ID = string.Empty;
            SqlDataSource src = new SqlDataSource();
            if (dt.Rows.Count > 0)
            {
                System.Collections.Hashtable al = Grid1.Rows[0].ToHashtable();
                ID = al["ID"].ToString();
            }
            if (OboutDropDownList1.SelectedValue == "Clients")
            {
                src = Functions.DB.GetSQLDataSource2("SELECT top 1 *  FROM CLIENT_DAT Where ID='" + ID + "'");
            }
            else if (OboutDropDownList1.SelectedValue == "Sales Reps")
            {
                src = Functions.DB.GetSQLDataSource("SELECT top 1 *  FROM SalesReps Where ID=" + ID);
            }

            // SuperForm1.DefaultMode = DetailsViewMode.ReadOnly;
            SuperForm1.DataSource = src;
            SuperForm1.DataBind();
        }
        private void BindDemo()
        {
            ITwitterAuthorizer autentikasi = GetInformasiKredensial();

            var TwitterDataContext = new TwitterContext(autentikasi);

            var hasilpencarian = (from search in TwitterDataContext.Search
                                  where search.Type == SearchType.Search &&
                                        search.Query == "#PERSIB" &&
                                        search.ResultType == ResultType.Recent &&
                                        search.PageSize == 100
                                  select search)
                .Single();

            System.Data.DataTable dt = new System.Data.DataTable();
            dt.Columns.Add("name");
            dt.Columns.Add("text");

            foreach (SearchEntry item in hasilpencarian.Results)
            {
                dt.Rows.Add(item.FromUser, item.Text);
            }

            gvMain.DataSource = dt;
            gvMain.DataBind();
        }
示例#4
0
        static void Main(string[] args)
        {
            MethodInfo[] ms = typeof(object).GetMethods();
            foreach (MethodInfo m in ms)
            {
                Console.WriteLine(m.ToString());
            }
            Console.WriteLine(FiboCalculator.Equals(10, 0.0));
            Console.WriteLine("***Fun With Conversions ***");
            int myInt = 12345678;
            myInt.DisplayDefiningAssembly();
            System.Data.DataTable dt = new System.Data.DataTable();
            dt.DisplayDefiningAssembly();

           Console.WriteLine( myInt.ReverseDigits());
           Console.WriteLine("扩展接口测试");
           string[] data = { "Wow", "this", "is ", "sort", "of", "annoying", "but", "in", "a", "weird", "way", "fun" };
           data.PrintDataAndBeep();
                Rectangle r=new Rectangle(5,4);
            Console.WriteLine(r.ToString());
            r.Draw();
            Square s = (Square)r;
            Console.WriteLine(s.ToString());
            s.Draw();
            Console.WriteLine(GC.GetTotalMemory(false)+"---"+GC.MaxGeneration);
          //  Console.ReadLine();
            BuildAnonType("BWM", "red", 1234);
        }
示例#5
0
        public void PopulateEmployerGroupDDL()
        {
            dbProcedures db = new dbProcedures();

            try
            {
                System.Data.SqlClient.SqlCommand sqlCmd = new System.Data.SqlClient.SqlCommand("SELECT DISTINCT EmployerGroup FROM tbl_Members ORDER BY EmployerGroup", new db().SqlConnection);
                sqlCmd.CommandType = System.Data.CommandType.Text;

                System.Data.DataTable loadReaderdata = new System.Data.DataTable();
                loadReaderdata.Load(sqlCmd.ExecuteReader());

                ddlEmployerGroup.DataSource = loadReaderdata;
                ddlEmployerGroup.DataTextField = "EmployerGroup";
                ddlEmployerGroup.DataValueField = "EmployerGroup";
                ddlEmployerGroup.DataBind();

                ddlEmployerGroup.Items.Insert(0, new ListItem("", ""));
                ddlEmployerGroup.SelectedIndex = 0;

            }
            catch (Exception ex)
            {
                db.LogAction("", "Error", "Error loading Members UI page. " + ex.Message.ToString());
            }

            db.Close();
        }
示例#6
0
        public void GetCSVTest()
        {
            var datatable = new System.Data.DataTable();
            datatable.Columns.Add("Col1", typeof (string));
            datatable.Columns.Add("Co12", typeof (string));
            datatable.Rows.Add("A", "ł");
            datatable.Rows.Add("ą", "ä");

            string failure = null;
            var thread = new System.Threading.Thread(() =>
                                                         {
                                                             var dataobject =
                                                                 System.Windows.Forms.Clipboard.GetDataObject();
                                                             Isotope.Clipboard.ClipboardUtil.SetDataCSVFromTable(
                                                                 dataobject, datatable);
                                                             System.Windows.Forms.Clipboard.SetDataObject(dataobject);

                                                             var out_csv = Isotope.Clipboard.ClipboardUtil.GetCSV();
                                                             System.Windows.Forms.Clipboard.Clear();
                                                         });
            thread.SetApartmentState(System.Threading.ApartmentState.STA);
            thread.Start();
            thread.Join();
            if (failure != null)
            {
                Assert.Fail();
            }
        }
        private void BindDemo()
        {
            ITwitterAuthorizer autentikasi = GetInformasiKredensial();

            var TwitterDataContext = new TwitterContext(autentikasi);

            var favorites =
                (from fav in TwitterDataContext.Favorites
                 where fav.Type == FavoritesType.Favorites &&
                       fav.IncludeEntities == true
                 select fav)
                .ToList();

            System.Data.DataTable dt = new System.Data.DataTable();
            dt.Columns.Add("name");
            dt.Columns.Add("text");

            foreach (Favorites item in favorites)
            {
                dt.Rows.Add(item.User.Name, item.Text);
            }

            gvMain.DataSource = dt;
            gvMain.DataBind();
        }
示例#8
0
 public ResultSetVM()
 {
     if (SQLStatement != null)
     {
         _results = _resultSet.readQuery(SQLStatement);
     }
 }
        public string getContasPagadoras(string processo)
        {
            string retorno = string.Empty;

            string sql = "SELECT c.concod, c.connome, fr.foncod, fr.fonnome, cl.valor "+
                            "FROM webprocesso_contasliquidacao cl "+
                            "join conta c on c.concod = cl.idconta "+
                            "join fonterecurso fr on fr.foncod = c.confonterecurso "+
                            "join webprocesso proc on proc.id = cl.idprocesso "+
                            "where proc.numero =" + processo;

            FbConnection conn = Persist.GetConn.getConn();

            FbCommand cmd = new FbCommand(sql, conn);

            FbDataAdapter dta = new FbDataAdapter(cmd);

            System.Data.DataTable dt = new System.Data.DataTable();

            dta.Fill(dt);

            if (dt.Rows.Count == 0)
            {
                retorno = "Processo sem conta bancaria informada !!!";
                ASPxGridView1.Visible = false;
                ASPxRoundPanel1.Visible = true;
            }
            else {
                ASPxRoundPanel1.Visible = false;
                ASPxGridView1.DataSource = dt;
                ASPxGridView1.DataBind();
            }

            return retorno;
        }
示例#10
0
		public Int32 Insert(AccountCategoryDetails Details)
		{
			try 
			{
                Save(Details);

                string SQL = "SELECT LAST_INSERT_ID();";
				  
				MySqlCommand cmd = new MySqlCommand();
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;
				
                string strDataTableName = "tbl" + this.GetType().FullName.Split(new Char[] { '.' })[this.GetType().FullName.Split(new Char[] { '.' }).Length - 1]; System.Data.DataTable dt = new System.Data.DataTable(strDataTableName);
                base.MySqlDataAdapterFill(cmd, dt);

                Int32 iID = 0;

                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    iID = Int32.Parse(dr[0].ToString());
                }

                return iID;
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
示例#11
0
//        public string CreateMYSQLModel(string DBName, string NameSpaceName, string TableName, string outputFilePath)
//        {
//            if (string.IsNullOrEmpty(DBName) || string.IsNullOrEmpty(NameSpaceName) || string.IsNullOrEmpty(TableName) || string.IsNullOrEmpty(outputFilePath))
//                return "";
//            Session.Session mysql = Session.SessionFactory.GetMySQL();

//            List<TableModel> tbs = mysql.FindAll<TableModel>(@"SELECT COLUMN_NAME,IS_NULLABLE,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH,COLUMN_COMMENT
// FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='" + DBName + "' AND TABLE_NAME='" + TableName + "' ;");

//            List<KEYModel> keys = mysql.FindAll<KEYModel>(@"SELECT b.COLUMN_NAME,b.DATA_TYPE FROM information_schema.KEY_COLUMN_USAGE a
// inner join information_schema.COLUMNS b on a.TABLE_SCHEMA=b.TABLE_SCHEMA and a.COLUMN_NAME=b.COLUMN_NAME and a.TABLE_NAME=b.TABLE_NAME
// WHERE a.TABLE_SCHEMA='" + DBName + "'  AND a.TABLE_NAME='" + TableName + "' and a.CONSTRAINT_NAME='PRIMARY'; ");

//            return OutPutStr(tbs, keys, NameSpaceName, TableName, outputFilePath);
//        }

        public string TestOracleConn()
        {

            //Session.Session oracle = Session.SessionFactory.GetOracle();

            //Session.Session sql = Session.SessionFactory.GetSQLServer();


            System.Data.DataTable sds = new System.Data.DataTable();
            //sds = oracle.FindAll("select * from INFORMATION ").Tables[0];

            //List<CONFERENCE> tbs = sql.FindAll<CONFERENCE>(@"SELECT * FROM Conference");
            //List<INFORMATION_Oracle> tbs2 = oracle.FindAll<INFORMATION_Oracle>(@"SELECT * FROM INFORMATION");


            int isOk = 0;
            //for (int i = 0; i < tbs.Count; i++)
            //{
                //ParamMap param = oracle.newMap();
                //param.Add("CONFERENCE_ID", tbs[i].ConferenceId);
                //param.Add("CONTENTS", tbs[i].Contents);
                //string sqlStr = "update CONFERENCE set CONTENTS=:CONTENTS  where CONFERENCE_ID=:CONFERENCE_ID ";
                // > 0;

                //CONFERENCE_Oracle o_info = oracle.FindByID<CONFERENCE_Oracle>(tbs[i].ConferenceId.ToString());
                //o_info.CONTENTS = tbs[i].Contents;
                //isOk += oracle.Update<CONFERENCE_Oracle>(o_info);

                //    oracle.ExcuteSQL(sqlStr, param);
                //o_info.INFO_ID = "2015060916531897637858e973c8bb9";
           // }
            return isOk.ToString();
        }
示例#12
0
        private void DataGrid_Initialized(object sender, System.EventArgs e)
        {
            // TODO: Delete all this code and replace it with a simple query when database is available.

            SourceDataTable = new System.Data.DataTable("Priorities");
            SourceDataTable.Columns.Add(new System.Data.DataColumn("ID", System.Type.GetType("System.Int32")));
            SourceDataTable.Columns.Add(new System.Data.DataColumn("Name", System.Type.GetType("System.String")));
            SourceDataTable.Columns.Add(new System.Data.DataColumn("Value", System.Type.GetType("System.Int32")));
            SourceDataTable.Columns.Add(new System.Data.DataColumn("Active", System.Type.GetType("System.Boolean")));

            System.Action<int, string, int, bool> AddNewRow = (id, name, value, active) =>
                {
                    var row = SourceDataTable.NewRow();
                    row["ID"] = id;
                    row["Name"] = name;
                    row["Value"] = value;
                    row["Active"] = active;
                    SourceDataTable.Rows.Add(row);
                };

            AddNewRow(1, "Haute", 1, true);
            AddNewRow(2, "Moyenne", 2, true);
            AddNewRow(3, "Faible", 3, true);

            Save();
        }
        public static System.Data.DataTable recuperaLista(DespesaUnidadeOrcamentaria desp)
        {
            string sql = "select uo.undnome, despCod, cc.cennome, despJan, despFev, despMar, despAbr, despMai, despJun," +
                            "despJul, despAgo, despSet, despOut, despNov, despDez, uo.undUnificado,uo.undCodigo,uo.undCodOrgao " +
                            "from " +
                            "despesaunidadeorcamentaria DUO " +
                            "join unidadeorcamentaria UO on uo.undcodorgao = duo.despunorgao and uo.undcodigo = duo.despunidade " +
                            "join centrocusto cc on cc.cencod = duo.despcencod " +
                            "where uo.undcodigo = '" + desp.UndOrca.undCodigo + "' and uo.undcodorgao = '" + desp.UndOrca.Org.orgCodigo + "'";

            System.Data.DataTable table = new System.Data.DataTable();
            table.Columns.Add("#", typeof(string));
            table.Columns.Add("Unidade", typeof(string));
            table.Columns.Add("Centro Custo", typeof(string));
            table.Columns.Add("JAN", typeof(string));
            table.Columns.Add("FEV", typeof(string));
            table.Columns.Add("MAR", typeof(string));
            table.Columns.Add("ABR", typeof(string));
            table.Columns.Add("MAI", typeof(string));
            table.Columns.Add("JUN", typeof(string));
            table.Columns.Add("JUL", typeof(string));
            table.Columns.Add("AGO", typeof(string));
            table.Columns.Add("SET", typeof(string));
            table.Columns.Add("OUT", typeof(string));
            table.Columns.Add("NOV", typeof(string));
            table.Columns.Add("DEZ", typeof(string));
            System.Data.DataTable dt = AcessoDados.AcessoDados.dtable(sql);
            foreach (System.Data.DataRow linha in dt.Rows)
            {
                if(!(linha["DespJan"].ToString().Equals("0") && linha["DespFev"].ToString().Equals("0") && linha["DespMar"].ToString().Equals("0") && linha["DespAbr"].ToString().Equals("0") && linha["DespMai"].ToString().Equals("0") && linha["DespJun"].ToString().Equals("0") && linha["DespJul"].ToString().Equals("0") && linha["DespAgo"].ToString().Equals("0") && linha["DespSet"].ToString().Equals("0") && linha["DespOut"].ToString().Equals("0") && linha["DespNov"].ToString().Equals("0") && linha["DespDez"].ToString().Equals("0"))){
                    table.Rows.Add(linha["despCod"].ToString(),linha["undnome"].ToString(),  linha["cennome"].ToString(), float.Parse(linha["DespJan"].ToString()).ToString("N"), float.Parse(linha["DespFev"].ToString()).ToString("N"), float.Parse(linha["DespMAR"].ToString()).ToString("N"), float.Parse(linha["DespABR"].ToString()).ToString("N"), float.Parse(linha["DespMAI"].ToString()).ToString("N"), float.Parse(linha["DespJUN"].ToString()).ToString("N"), float.Parse(linha["DespJUL"].ToString()).ToString("N"), float.Parse(linha["DespAGO"].ToString()).ToString("N"), float.Parse(linha["DespSET"].ToString()).ToString("N"), float.Parse(linha["DespOUT"].ToString()).ToString("N"), float.Parse(linha["DespNOV"].ToString()).ToString("N"), float.Parse(linha["DespDEZ"].ToString()).ToString("N"));
                }
            }
            return table;
        }
        private void BindDemo()
        {
            ITwitterAuthorizer autentikasi = GetInformasiKredensial();

            var TwitterDataContext = new TwitterContext(autentikasi);

            string _screen_name = "kicaubobotoh"; //screen name yang melakukan retweet

            var liststatus = (from tweet in TwitterDataContext.Status
                              where tweet.Type == StatusType.RetweetedByUser &&
                                    tweet.ScreenName == _screen_name
                              select tweet.RetweetedStatus)
                .ToList();

            System.Data.DataTable dt = new System.Data.DataTable();
            dt.Columns.Add("name");
            dt.Columns.Add("text");

            foreach (Status item in liststatus)
            {
                dt.Rows.Add(item.User.Name, item.Text);
            }

            gvMain.DataSource = dt;
            gvMain.DataBind();
        }
        private System.Data.DataTable GetData(int city, string lang)
        {
            try
            {
                SqlConnection myConnection = new SqlConnection("user id=Uib;" +
                                     "password=Uib;server=localhost;" +
                                     "Trusted_Connection=yes;" +
                                     "database=Uib; " +
                                     "connection timeout=30");
                myConnection.Open();
                var command = new SqlCommand("GET_HOTELS_BY_CITY", myConnection);
                command.CommandType = System.Data.CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@city", city);
                command.Parameters.AddWithValue("@lang", lang);
                SqlDataReader reader = command.ExecuteReader();
                var dataTable = new System.Data.DataTable();

                dataTable.Load(reader);
                reader.Close();
                myConnection.Close();
                return dataTable;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            return null;
        }
        private void BindDemo()
        {
            ITwitterAuthorizer autentikasi = GetInformasiKredensial();

            var TwitterDataContext = new TwitterContext(autentikasi);

            string _screen_name = "kicaubobotoh";//screen_name dari timeline yang hendak di tampilkan

            var liststatus = from tweet in TwitterDataContext.Status
                             where tweet.Type == StatusType.User &&
                                   tweet.ScreenName == _screen_name &&
                                   tweet.CreatedAt < DateTime.Now.AddDays(-10).Date
                             select new
                             {
                                 tweet.User.Name,
                                 tweet.RetweetedStatus,
                                 tweet.Text
                             };

            System.Data.DataTable dt = new System.Data.DataTable();
            dt.Columns.Add("name");
            dt.Columns.Add("text");

            foreach (var item in liststatus)
            {
                dt.Rows.Add(item.Name, item.Text);
            }

            gvMain.DataSource = dt;
            gvMain.DataBind();
        }
示例#17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["id"] != null && Request.QueryString["id"].ToString() != "")
            {
                string orderid = Request.QueryString["id"].ToString();
                order= obll.getOrdersViewModel(int.Parse(orderid));
                this.customer_name.Text = order.Username;
                this.sales_orderid.Text = order.OrderNo;
                this.customer_address.Text = order.Address;

                //查询详细客户信息
                 c= cb.GetModel(int.Parse(order.Customerid.ToString()));
                 this.customer_linker.Text = c.link_men;
                 this.customer_tel.Text = order.Tel + "/" + order.Mobile;
                 this.customet_email.Text = c.email;

                //查询详细物流公司信息
                tbLogs logs=new tbLogs();
                tbLogsBLL tblogbll=new tbLogsBLL();
                if (order.Logid != null)
                {
                    logs = tblogbll.tbLogs_GetModel(order.Logid.ToString());
                    this.logistics.Text = logs.LogisticsName;
                    this.logistics_num.Text = order.LogNumber;
                }
                this.state.Text = order.StateName;
                this.create_date.Text = DateTime.Parse(order.createdate.ToString()).ToString("yyyy-MM-dd");
                attach_pay.Text =decimal.Parse(order.Postmoney.ToString()).ToString("0.00");

                dt = sql.getDataByCondition("dbo.OrdersPro_View", "*", " OrderID="+order.OrderID);

            }
        }
示例#18
0
        private static string calculateStringOperation(string[] temp)
        {
            // First things first!
            string operationString = "";
            string tempVar;
            bool errorFlag = false;

            for (int i = 0; i < temp.Length; i++)
            {
            if (temp[i].Equals(".add.")) { temp[i] = " + "; }
            else if (temp[i].Equals(".sub.")) { temp[i] = " - "; }
            else if (temp[i].Equals(".mul.")) { temp[i] = " * "; }
            else if (temp[i].Equals(".div.")) { temp[i] = " / "; }
            else if (isVariableName(temp[i])) {
                if (variables.ContainsKey(temp[i])) { variables.TryGetValue(temp[i], out tempVar); temp[i] = tempVar; }
                else if (!variables.ContainsKey(temp[i])) { errorFlag = true; }
            }
            else if (isString(temp[i])) { temp[i] = temp[i].Replace('"', '\''); }
            }

            foreach (string s in temp) { operationString += s; }
            //Console.WriteLine(operationString);
            if (!errorFlag)
            {
            var result = new System.Data.DataTable().Compute(operationString, null).ToString();
            //ExpressionEval expr = new ExpressionEval(operationString);
            //object result = expr.Evaluate();
            //Console.WriteLine("Test: " + result);
            return result; //(string)result;
            }
            else
            {
            return null;
            }
        }
		public Int64 Insert(ProductGroupUnitsMatrixDetails Details)
		{
			try 
			{
                Save(Details);

                string SQL = "SELECT LAST_INSERT_ID();";
	 			
				MySqlCommand cmd = new MySqlCommand();
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;

                System.Data.DataTable dt = new System.Data.DataTable("LAST_INSERT_ID");
                base.MySqlDataAdapterFill(cmd, dt);

                Int64 iID = 0;
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    iID = Int64.Parse(dr[0].ToString());
                }					

				return iID;
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
示例#20
0
		public System.Data.DataTable DataReaderToDataTable(MySqlDataReader Reader)
		{
			System.Data.DataTable dt = new System.Data.DataTable();
			System.Data.DataColumn dc;
			System.Data.DataRow dr;
			ArrayList arr = new ArrayList();
			int i;

			for(i=0;i<Reader.FieldCount;i++)
			{
				dc = new System.Data.DataColumn();

				dc.ColumnName = Reader.GetName(i);					
				arr.Add(dc.ColumnName);

				dt.Columns.Add(dc);
			}
			
			while(Reader.Read())
			{
				dr = dt.NewRow();

				for (i=0;i<Reader.FieldCount;i++)
				{
					dr[(string)arr[i]] = Reader[i].ToString();
				}
				dt.Rows.Add(dr);
			}

			Reader.Close();
			return dt;
		}
示例#21
0
        public static System.Data.DataTable GetDataTable(string strSQL)
        {
            System.Data.DataTable dt = new System.Data.DataTable();
            System.Data.SqlClient.SqlConnectionStringBuilder csb = new System.Data.SqlClient.SqlConnectionStringBuilder();

            csb.DataSource = System.Environment.MachineName;
            csb.DataSource = @"VMSTZHDB08\SZH_DBH_1";
            csb.InitialCatalog = "HBD_CAFM_V3";

            csb.DataSource = "CORDB2008R2";
            csb.InitialCatalog = "Roomplanning";

            // csb.DataSource = "cordb2014";
            // csb.InitialCatalog = "ReportServer";

            csb.DataSource = @"CORDB2008R2";
            csb.InitialCatalog = "COR_Basic_SwissLife";

            csb.IntegratedSecurity = true;

            using (System.Data.Common.DbDataAdapter da = new System.Data.SqlClient.SqlDataAdapter(strSQL, csb.ConnectionString))
            {
                da.Fill(dt);
            }

            return dt;
        }
示例#22
0
文件: Tools.cs 项目: eatage/AppTest
 /// <summary>
 /// 返回当前客户所在省区下的指定产品已有经销商的城市
 /// </summary>
 /// <param name="as_cusCode">客户编号</param>
 /// <param name="as_gooCode">商品编号</param>
 /// <returns></returns>
 public static string of_GetGoocodeToUseCity(string as_cusCode, string as_gooCode)
 {
     if (string.IsNullOrEmpty(as_cusCode) || string.IsNullOrEmpty(as_gooCode))
         return "";
     string ls_sql_prov = "select cus_prov from customer where cus_code='" + as_cusCode + "'";
     string ls_prov = "";
     ls_prov = SqliteHelper.ExecuteScalar(ls_sql_prov);
     if (string.IsNullOrEmpty(ls_prov))
         return "";
     string ls_sql_use = @"select cityname from city where cityno in (select cus_city 
                       from oldsaleprice,goodsno,customer 
                       where oldsaleprice.cus_code=customer.cus_code 
                       and customer.cus_prov=@cus_prov 
                       and oldsaleprice.goo_code=goodsno.goo_code 
                       and goodsno.goo_code=@goo_code 
                       group by cus_city)";
     ls_sql_use = ls_sql_use.Replace("@cus_prov", "'" + ls_prov + "'");
     ls_sql_use = ls_sql_use.Replace("@goo_code", "'" + as_gooCode + "'");
     System.Data.DataTable ldt_use = new System.Data.DataTable();
     ldt_use = SqliteHelper.ExecuteDataTable(ls_sql_use);
     if (ldt_use == null)
         return "";
     if (ldt_use.Rows.Count == 0)
         return "";
     string ls_use = "";
     for (int i = 0; i < ldt_use.Rows.Count; i++)
     {
         if (i == ldt_use.Rows.Count - 1)
             ls_use += ldt_use.Rows[i]["cityname"] == null ? "" : ldt_use.Rows[i]["cityname"].ToString() + "";
         else
             ls_use += ldt_use.Rows[i]["cityname"] == null ? "" : ldt_use.Rows[i]["cityname"].ToString() + ",";
     }
     return ls_use;
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            System.Data.DataTable world = new System.Data.DataTable("World Population");
            world.Columns.AddRange(new System.Data.DataColumn[] {
                new System.Data.DataColumn("Country",typeof(string)),
                new System.Data.DataColumn("Population",typeof(int))
            });
            world.Rows.Add(new object[] { "Germany", 200 });
            world.Rows.Add(new object[] { "United States", 350 });
            world.Rows.Add(new object[] { "Brazil", 250 });
            world.Rows.Add(new object[] { "Canada", 75 });
            world.Rows.Add(new object[] { "France", 290 });
            world.Rows.Add(new object[] { "Russia", 700 });
            world.Rows.Add(new object[] { "China", 1300 });
            world.Rows.Add(new object[] { "India", 1000 });

            this.GVGeoMap1.GviRegion = GoogleChartsNGraphsControls.MapRegion.World;
            this.GVGeoMap1.GviDisplayMode = GoogleChartsNGraphsControls.MapDisplayModes.Regions;
            this.GVGeoMap1.GviColors = new Color?[] { Color.Blue, Color.Cornsilk, Color.DarkMagenta, Color.DarkTurquoise, Color.FloralWhite };
            this.GVGeoMap1.DataSource = world;

            System.Data.DataTable projs = new System.Data.DataTable("US Projects");
            projs.Columns.AddRange(new System.Data.DataColumn[] {
                new System.Data.DataColumn("City",typeof(string)),
                new System.Data.DataColumn("Completion",typeof(int)),
                new System.Data.DataColumn("Comments",typeof(string))
            });
            projs.Rows.Add(new object[] { "Astoria, NY", 95, "Astoria: Almost Done" });
            projs.Rows.Add(new object[] { "Novato, CA", 35, "Novato: Just Starting" });
            projs.Rows.Add(new object[] { "Duvall, WA", 10, "Duvall: Just Starting" });

            this.GVGeoMap2.GviOptionsOverride = "{'region':'US','colors':[0xFF8747, 0xFFB581, 0xc06000], 'dataMode':'markers'}";
            this.GVGeoMap2.DataSource = projs;
        }
示例#24
0
        public System.Data.DataTable ConsultaMySQL(String query,MySqlParameterCollection parametros,System.Data.CommandType tipo_comando)
        {
            System.Data.DataTable tabla = new System.Data.DataTable();
            try {

            MySqlDataAdapter adapter = new MySqlDataAdapter();
            MySqlCommand comando = new MySqlCommand(query, canal);
            comando.CommandType = tipo_comando;
            if (parametros != null)
            {
                foreach (var item in parametros)
                {
                    comando.Parameters.Add(item);

                }
            }

            adapter.SelectCommand = comando;
            adapter.Fill(tabla);
            if (tabla.Rows.Count > 0)
            {
                return tabla;
            }
            else {
                return null;
            }

            }
            catch (Exception er) { MessageBox.Show("error: " + er.Message); return null; }
        }
示例#25
0
文件: GestorIvas.cs 项目: riseven/TPV
        public static void Init()
        {
            dataTable = new System.Data.DataTable("Ivas");
            System.Data.DataColumn myDataColumn;

            myDataColumn = new System.Data.DataColumn();
            myDataColumn.DataType = System.Type.GetType("System.Int32");
            myDataColumn.ColumnName = "Codigo";
            dataTable.Columns.Add(myDataColumn);

            myDataColumn = new System.Data.DataColumn();
            myDataColumn.DataType = System.Type.GetType("System.Int32");
            myDataColumn.ColumnName = "Porcentaje";
            dataTable.Columns.Add(myDataColumn);

            dataTable.PrimaryKey = new System.Data.DataColumn[]{dataTable.Columns["Codigo"]} ;

            System.Data.DataRow dataRow ;
            for ( int i = 0 ; i < 5 ; i++ )
            {
                dataRow = dataTable.NewRow();
                dataRow["Codigo"] = i+1 ;
                dataRow["Porcentaje"] = 0 ;
                dataTable.Rows.Add(dataRow);
            }
        }
示例#26
0
        public static void ToCSV(string path, string[,] data)
        {
            System.Data.DataTable dt = new System.Data.DataTable();

            int row = data.GetLength(0);
            int column = data.GetLength(1);
            for (int j = 0; j < column; j++)
            {
                dt.Columns.Add(data[0, j], typeof(String));
            }

            for (int i = 0; i < row; i++)   //含表头
            {
                dt.Rows.Add(dt.NewRow());
                for (int j = 0; j < column; j++)
                {
                    if (!String.IsNullOrEmpty(data[i, j]))
                    {
                        dt.Rows[i][j] = "\"" + data[i, j].Replace("\"", "\"\"") + "\"";
                    }
                }
            }
            dt.AcceptChanges();

            CsvOptions options = new CsvOptions("String[,]", ',', data.GetLength(1));
            CsvEngine.DataTableToCsv(dt, path, options);
        }
        private System.Data.DataTable GetAllBenchmarks()
        {
            HtmlAgilityPack.HtmlWeb web = new HtmlAgilityPack.HtmlWeb();
            //HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.Load(@"");
            HtmlAgilityPack.HtmlDocument doc = web.Load(@"http://benchmarksgame.alioth.debian.org/");

            System.Data.DataTable dt = new System.Data.DataTable();

            dt.Columns.Add("Name", typeof(string));
            dt.Columns.Add("Url", typeof(string));

            System.Data.DataRow dr = null;

            foreach (HtmlAgilityPack.HtmlNode link in doc.DocumentNode.SelectNodes("//section[1]//li/a[@href]"))
            {
                dr = dt.NewRow();
                // System.Console.WriteLine(link);
                dr["Name"] = System.Web.HttpUtility.HtmlDecode(link.InnerText);
                dr["Url"] = link.Attributes["href"].Value;

                dt.Rows.Add(dr);
            } // Next link

            System.Data.DataView dv = dt.DefaultView;
            dv.Sort = "Name ASC";
            System.Data.DataTable sortedDT = dv.ToTable();

            return sortedDT;
        }
示例#28
0
 /// <summary>
 /// Release the resources.
 /// </summary>
 public void Dispose() {
     _table.Dispose();
     _table = null;
     _rowsall = null;
     _rowswhere = null;
     _cells = null;
 }
示例#29
0
		public Reference.ReferencedClass1 UseAllReferences()
		{
			System.Data.DataTable dt = new System.Data.DataTable();
			System.Xml.XmlDocument doc = new System.Xml.XmlDocument();

			Console.WriteLine(Reference.ReferencedClass1.UseMe().ToString());
			return Reference.ReferencedClass1.UseMe();
		}
 /// <summary>
 /// Don't actually open the shapefile in this case, just initialize the
 /// major variables.
 /// </summary>
 public ShapefileFeatureSet()
 {
     //Fields = new Dictionary<string, Field>();
     _columns = new List<Field>();
     DataTable = new System.Data.DataTable();
     Features = new FeatureList(this);
     FeatureType = FeatureTypes.Unspecified;
 }
        protected void hastalisteGridView_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.CompareTo("Select") == 0)
            {
                var         index          = Convert.ToInt32(e.CommandArgument);
                MongoClient client         = new MongoClient();
                var         database       = client.GetDatabase("hastane");
                var         collection     = database.GetCollection <yatanhastalar>("yatanhastalar");
                var         doktorlistesi  = collection.Find(x => x._id != null).ToList().SelectMany(x => x.ServisList).Where(x => x._id == ObjectId.Parse(ddlServis.SelectedValue));
                var         servislistesi  = doktorlistesi.SelectMany(x => x.HastaList).ToList().Where(x => x._id == ObjectId.Parse(hastalisteGridView.Rows[index].Cells[1].Text));
                var         ilaclist       = servislistesi.SelectMany(x => x.IlacList).ToList();
                var         ilacistekdurum = servislistesi.Where(x => x.hasta_tedavi_durum == "Onaylandı").Select(x => x.hasta_tedavi_durum).FirstOrDefault();
                if (ilacistekdurum == "Onaylandı")
                {
                    dt = new System.Data.DataTable("DataTable");
                    ds = new System.Data.DataSet("DataSet");
                    dt.Columns.Add("ID").DefaultValue.ToString();
                    dt.Columns.Add("İlaç Adı").DefaultValue.ToString();
                    dt.Columns.Add("İlaç Barkod").DefaultValue.ToString();
                    dt.Columns.Add("İlaç Uygulanacak Adet").DefaultValue.ToString();
                    foreach (var item in ilaclist)
                    {
                        string[] array = { item._id.ToString(), item.ilac_adi.ToString(), item.barkod.ToString(), item.ilac_uygulanacak_adet.ToString() };
                        dt.Rows.Add(array);
                    }
                    ds.Tables.Add(dt);
                    ilaclisteleGridView1.DataSource = ds;
                    ilaclisteleGridView1.DataMember = "DataTable";
                    ilaclisteleGridView1.DataBind();
                }
                else if (ilacistekdurum == null)
                {
                    dt = new System.Data.DataTable("DataTable");
                    ds = new System.Data.DataSet("DataSet");
                    dt.Columns.Add("Durum").DefaultValue.ToString();
                    string yazi = "Tedavisi Bulunmamaktadır";
                    dt.Rows.Add(yazi);
                    ds.Tables.Add(dt);
                    ilaclisteleGridView1.DataSource = ds;
                    ilaclisteleGridView1.DataMember = "DataTable";
                    ilaclisteleGridView1.DataBind();
                }
                else
                {
                    dt = new System.Data.DataTable("DataTable");
                    ds = new System.Data.DataSet("DataSet");
                    string yazi = "Tedavi Eczaneden Onay Bekliyor";
                    dt.Columns.Add("Durum").DefaultValue.ToString();
                    dt.Rows.Add(yazi);
                    ds.Tables.Add(dt);
                    ilaclisteleGridView1.DataSource = ds;
                    ilaclisteleGridView1.DataMember = "DataTable";
                    ilaclisteleGridView1.DataBind();
                }
                ListBoxRadyoloji.Items.Clear();
                var radyolojiistekdurumu = servislistesi.Where(x => x.hasta_radyoloji_durum == "İstek Bulunmaktadır").Select(x => x.hasta_radyoloji_durum).FirstOrDefault();
                if (radyolojiistekdurumu == "İstek Bulunmaktadır")
                {
                    var radyoloji = servislistesi.Where(x => x.hasta_radyoloji_durum == "İstek Bulunmaktadır").SelectMany(x => x.RadyolojiList).ToList();
                    var radistek  = radyoloji.SelectMany(x => x.TetkiklerList).ToList();

                    foreach (var item in radistek)
                    {
                        string rad = item.tahlil_adi;
                        ListBoxRadyoloji.Items.Add(rad);
                    }
                }
                else
                {
                    string yazi = "Radyoloji Tetkik İsteği Bulunamadı";
                    ListBoxRadyoloji.Items.Add(yazi);
                }
                var laboratuvaristekdurumu = servislistesi.Where(x => x.hasta_tahlil_durum == "İstek Bulunmaktadır").Select(x => x.hasta_tahlil_durum).FirstOrDefault();
                if (laboratuvaristekdurumu == "İstek Bulunmaktadır")
                {
                    var laboratuvar = servislistesi.Where(x => x.hasta_tahlil_durum == "İstek Bulunmaktadır").SelectMany(x => x.KanTahlilList).ToList();
                    var labistek    = laboratuvar.SelectMany(x => x.TahlilList).ToList();
                    ListBoxKanTahlil.Items.Clear();
                    foreach (var item in labistek)
                    {
                        string lab = item.tahlil_adi;
                        ListBoxKanTahlil.Items.Add(lab);
                    }
                }
                else
                {
                    string yazi = "Kan Tahlil İsteği Bulunamadı";
                    ListBoxKanTahlil.Items.Add(yazi);
                }
            }
        }
示例#32
0
 public bool DoExcelUpload(System.Guid p_certapp, System.Data.DataTable p_uploadTable, string p_createdBy)
 {
     return(base.Channel.DoExcelUpload(p_certapp, p_uploadTable, p_createdBy));
 }
示例#33
0
 public bool AddCheckedAmountCombination(System.Data.DataTable dt)
 {
     return(base.Channel.AddCheckedAmountCombination(dt));
 }
        protected void btnGenerar_Click(object sender, EventArgs e)
        {
            int  Entero   = 0;
            bool HayError = false;

            lblMensaje.Text = "";

            if (!DatosGenerales.EsFecha(txtFechaPresentacion.Text))
            {
                HayError         = true;
                lblMensaje.Text += "Fecha de presentación incorrecta<br />";
            }

            int.TryParse(txtEjercicioReportado.Text, out Entero);

            if (Entero < 2015 || Entero > DateTime.Now.Year)
            {
                HayError         = true;
                lblMensaje.Text += "Ejercicio reportado incorrecto<br />";
            }

            Entero = 0;
            int.TryParse(txtTipoDeclaracion.Text, out Entero);

            if (Entero == 2 && !DatosGenerales.EsFecha(txtFechaUltimaD.Text))
            {
                HayError         = true;
                lblMensaje.Text += "Fecha de declaración incorrecta<br />";
            }

            if (HayError)
            {
                return;
            }

            string Lotes = "";
            int    Id;

            Entero = 0;

            for (int w = 0; w < grdDatos.Rows.Count; w++)
            {
                CheckBox chkId = (CheckBox)grdDatos.Rows[w].FindControl("chkId");

                if (chkId.Checked)
                {
                    Id = 0;
                    int.TryParse(grdDatos.Rows[w].Cells[CeldaId].Text, out Id);

                    if (Id > 0)
                    {
                        Entero++;
                        Lotes += Id.ToString() + "|";
                    }
                }
            }

            if (Entero == 0)
            {
                lblMensaje.Text += "No ha seleccionado ningún elemento de la lista<br />";
                return;
            }

            int ConsReg = 0;

            int.TryParse(txtConsecutivoReg.Text, out ConsReg);

            if (ConsReg <= 0)
            {
                ConsReg = 1;
            }

            if (!string.IsNullOrWhiteSpace(Lotes))
            {
                string Archivo = Server.MapPath("../Reportes/TmpFiles/") + DatosGenerales.GeneraNombreArchivoRnd(txtRFC.Text + txtEjercicioReportado.Text + ConsReg.ToString().PadLeft(3, '0') + "H_", "txt");
                System.IO.TextWriter tw;

                tw = new System.IO.StreamWriter(Archivo, false, System.Text.Encoding.ASCII);

                int      TipoReg = 0;
                DateTime FechaP;
                int      Ejercicio = 0;

                int.TryParse(txtTipoReg.Text, out TipoReg);
                FechaP = DatosGenerales.ObtieneFecha(txtFechaPresentacion.Text);
                int.TryParse(txtEjercicioReportado.Text, out Ejercicio);

                //Encabezado
                tw.WriteLine(ArmarEncabezado(TipoReg, ConsReg, ConsReg, FechaP, Ejercicio, txtRFC.Text));

                //Detalle
                System.Data.DataTable Tabla = new System.Data.DataTable();

                Tabla = objCon.GenerarTXTSAT(Lotes);

                for (int w = 0; w < Tabla.Rows.Count; w++)
                {
                    tw.WriteLine(Tabla.Rows[w][0].ToString());
                }

                //Sumario
                int TipoDecl = 0;

                int.TryParse(txtTipoDeclaracion.Text, out TipoDecl);
                int.TryParse(txtTipoRegSum.Text, out TipoReg);
                tw.WriteLine(ArmarSumario(TipoReg, Tabla.Rows.Count + 2, Tabla.Rows.Count, TipoDecl, DatosGenerales.ObtieneFecha(txtFechaUltimaD.Text)));

                tw.Close();

                DatosGenerales.EnviaMensaje("Se ha creado el archivo para envío al SAT. Puede descargarlo ahora. Para algunos navegadores se recomienda dar clic secundario sobre 'Descargar' y seleccionar 'Guardar enlace como...'.", "Proceso finalizado", System.IO.Path.GetFileName(Archivo), DatosGenerales.TiposMensaje.Informacion);
            }
        }
示例#35
0
        public void ImportConfig(string file)
        {
            //this method provides a mechanism for moving config data from one install to another

            ActivityConfig newConfig = new ActivityConfig();

            newConfig.ReadXml(file);
            if (newConfig.ACSeries.Count == 0)
            {
                throw new atLogic.AtriumException("The file you tried to import is not an Activity Config export.");
            }

            bool okToDelete = AtMng.GetSetting(AppBoolSetting.AllowActivityDeleteOnConfigPush);

            try
            {
                AtMng.acMng.isMerging = true;
                //process deletes
                //check for used acseries first!
                string filt = "";
                string used = "";
                foreach (ActivityConfig.ACSeriesRow trgDr in DB.ACSeries)
                {
                    if (newConfig.ACSeries.PrimaryKey[0].DataType == typeof(string))
                    {
                        filt = newConfig.ACSeries.PrimaryKey[0].ColumnName + "='" + trgDr[newConfig.ACSeries.PrimaryKey[0].ColumnName].ToString() + "'";
                    }
                    else
                    {
                        filt = newConfig.ACSeries.PrimaryKey[0].ColumnName + "=" + trgDr[newConfig.ACSeries.PrimaryKey[0].ColumnName].ToString();
                    }

                    System.Data.DataRow[] srcDr = newConfig.ACSeries.Select(filt, "");
                    if (srcDr.Length == 0)
                    {
                        if (trgDr.StepType == (int)atriumBE.StepType.Activity)
                        {
                            int count = (int)AtMng.DALMngr.ExecuteScalarSQL("select count(*) from vactivity where acseriesid=" + trgDr.ACSeriesId.ToString());
                            if (count > 0)
                            {
                                if (okToDelete)
                                {
                                    System.Data.DataTable dtA = AtMng.GetGeneralRec("select activityid,ts from vactivity where acseriesid=" + trgDr.ACSeriesId.ToString());
                                    foreach (System.Data.DataRow drA in dtA.Rows)
                                    {
                                        AtMng.DALMngr.ExecuteSP("ActivityDelete", drA[0], null, drA[1]);
                                    }
                                }
                                else
                                {
                                    used += trgDr.StepCode + "; ";
                                }
                            }
                        }

                        //look in officemandate and remove
                        foreach (ActivityConfig.OfficeMandateRow omr in trgDr.GetOfficeMandateRows())
                        {
                            omr.Delete();
                        }
                    }
                }

                if (used.Length > 0)
                {
                    DB.OfficeMandate.RejectChanges();
                    throw new Exception("The following steps have been used and can't be deleted:\n\r" + used);
                }

                DeleteFromTable(DB.Menu, newConfig.Menu);
                DeleteFromTable(DB.ACTaskType, newConfig.ACTaskType);
                DeleteFromTable(DB.OfficeMandate, newConfig.OfficeMandate);
                DeleteFromTable(DB.ActivityField, newConfig.ActivityField);
                DeleteFromTable(DB.ACDependency, newConfig.ACDependency);
                DeleteFromTable(DB.ACBF, newConfig.ACBF);
                DeleteFromTable(DB.ACFileType, newConfig.ACFileType);
                DeleteFromTable(DB.ACConvert, newConfig.ACConvert);
                DeleteFromTable(DB.ACMenu, newConfig.ACMenu);
                DeleteFromTable(DB.ACDisb, newConfig.ACDisb);
                DeleteFromTable(DB.ACSeries, newConfig.ACSeries);
                DeleteFromTable(DB.ActivityCode, newConfig.ActivityCode);
                DeleteFromTable(DB.Series, newConfig.Series);
                DeleteFromTable(DB.ACMajor, newConfig.ACMajor);
                DeleteFromTable(DB.ACDocumentation, newConfig.ACDocumentation);
                DeleteFromTable(DB.ACControlType, newConfig.ACControlType);
                DeleteFromTable(DB.ACDependencyType, newConfig.ACDependencyType);
                DeleteFromTable(DB.ACSeriesType, newConfig.ACSeriesType);
                DeleteFromTable(DB.SeriesPackage, newConfig.SeriesPackage);
                DeleteFromTable(DB.SeriesStatus, newConfig.SeriesStatus);

                //atLogic.BusinessProcess bpD = AtMng.GetBP();

                //bpD.AddForUpdate(DB.OfficeMandate);
                //bpD.AddForUpdate(DB.ActivityField);
                //bpD.AddForUpdate(DB.ACDependency);
                //bpD.AddForUpdate(DB.ACBF);
                //bpD.AddForUpdate(DB.ACConvert);
                //bpD.AddForUpdate(DB.ACFileType);
                //bpD.AddForUpdate(DB.ACDisb);
                //bpD.AddForUpdate(DB.ACMenu);
                //bpD.AddForUpdate(DB.ACSeries);
                //bpD.AddForUpdate(DB.ActivityCode);
                //bpD.AddForUpdate(DB.Series);
                //bpD.AddForUpdate(DB.ACMajor);
                //bpD.AddForUpdate(DB.ACDocumentation);
                //bpD.AddForUpdate(DB.ACControlType);
                //bpD.AddForUpdate(DB.ACDependencyType);
                //bpD.AddForUpdate(DB.ACSeriesType);
                //bpD.AddForUpdate(DB.ACTaskType);
                //bpD.AddForUpdate(DB.SeriesStatus);
                //bpD.AddForUpdate(DB.SeriesPackage);
                //bpD.AddForUpdate(DB.Menu);

                //bpD.Update();

                //process tables for add and update
                ImportTable(DB.Menu, newConfig.Menu);
                ImportTable(DB.ACTaskType, newConfig.ACTaskType);
                ImportTable(DB.ACMajor, newConfig.ACMajor);
                ImportTable(DB.Series, newConfig.Series);
                ImportTable(DB.ActivityCode, newConfig.ActivityCode);
                ImportTable(DB.ACSeries, newConfig.ACSeries);
                ImportTable(DB.ActivityField, newConfig.ActivityField);
                ImportTable(DB.ACBF, newConfig.ACBF);
                ImportTable(DB.ACDependency, newConfig.ACDependency);
                ImportTable(DB.ACFileType, newConfig.ACFileType);
                ImportTable(DB.ACConvert, newConfig.ACConvert);
                ImportTable(DB.ACMenu, newConfig.ACMenu);
                ImportTable(DB.ACDisb, newConfig.ACDisb);
                ImportTable(DB.OfficeMandate, newConfig.OfficeMandate);
                ImportTable(DB.ACDocumentation, newConfig.ACDocumentation);
                ImportTable(DB.ACControlType, newConfig.ACControlType);
                ImportTable(DB.ACDependencyType, newConfig.ACDependencyType);
                ImportTable(DB.ACSeriesType, newConfig.ACSeriesType);
                ImportTable(DB.SeriesPackage, newConfig.SeriesPackage);
                ImportTable(DB.SeriesStatus, newConfig.SeriesStatus);

                atLogic.BusinessProcess bp = AtMng.GetBP();

                bp.AddForUpdate(DB.Menu);
                bp.AddForUpdate(DB.ACTaskType);
                bp.AddForUpdate(DB.ACMajor);
                bp.AddForUpdate(DB.Series);
                bp.AddForUpdate(DB.ActivityCode);
                bp.AddForUpdate(DB.ACSeries);
                bp.AddForUpdate(DB.ActivityField);
                bp.AddForUpdate(DB.ACDependency);
                bp.AddForUpdate(DB.ACBF);
                bp.AddForUpdate(DB.ACConvert);
                bp.AddForUpdate(DB.ACFileType);
                bp.AddForUpdate(DB.ACDisb);
                bp.AddForUpdate(DB.ACMenu);
                bp.AddForUpdate(DB.OfficeMandate);
                bp.AddForUpdate(DB.ACDocumentation);
                bp.AddForUpdate(DB.ACControlType);
                bp.AddForUpdate(DB.ACDependencyType);
                bp.AddForUpdate(DB.ACSeriesType);
                bp.AddForUpdate(DB.SeriesStatus);
                bp.AddForUpdate(DB.SeriesPackage);

                bp.Update();

                AtMng.acMng.isMerging = false;;
            }
            catch (Exception x)
            {
                DB.RejectChanges();
                AtMng.acMng.isMerging = false;
                throw x;
            }
        }
示例#36
0
                public override void OnLoad()
                {
                        if (this.Registro != null) {
                                this.Numero = System.Convert.ToInt32(m_Registro["numero"]);
                                this.PV = System.Convert.ToInt32(m_Registro["pv"]);

                                if (m_Registro["id_concepto"] != null)
                                        this.Concepto = new Lbl.Cajas.Concepto(this.Connection, this.GetFieldValue<int>("id_concepto"));
                                else
                                        this.Concepto = null;

                                if (m_Registro["concepto"] != null)
                                        this.ConceptoTexto = m_Registro["concepto"].ToString();
                                else
                                        this.ConceptoTexto = string.Empty;

                                this.Cobros = new ColeccionDeCobros();
                                this.Pagos = new ColeccionDePagos();

                                // Cargo pagos asociados al registro
                                // Pagos en efectivo
                                using (System.Data.DataTable TablaPagos = Connection.Select("SELECT * FROM cajas_movim WHERE id_caja=" + Lfx.Workspace.Master.CurrentConfig.Empresa.CajaDiaria.ToString() + " AND id_recibo=" + Id.ToString())) {
                                        foreach (System.Data.DataRow Pago in TablaPagos.Rows) {
                                                decimal ImporteCaja = System.Convert.ToDecimal(Pago["importe"]);
                                                if (this.DePago && ImporteCaja < 0) {
                                                        Pago Pg = new Pago(this.Connection, Lbl.Pagos.TiposFormasDePago.Efectivo, -ImporteCaja);
                                                        Pg.Recibo = this;
                                                        Pagos.Add(Pg);
                                                } else if (this.DePago == false && ImporteCaja > 0) {
                                                        Cobro Cb = new Cobro(this.Connection, Lbl.Pagos.TiposFormasDePago.Efectivo, ImporteCaja);
                                                        Cb.Recibo = this;
                                                        Cobros.Add(Cb);
                                                }
                                        }
                                }

                                // Pagos con cheque
                                using (System.Data.DataTable TablaPagos = this.Connection.Select("SELECT * FROM bancos_cheques WHERE (id_recibo=" + this.Id.ToString() + " OR id_recibo_pago=" + this.Id.ToString() + ")")) {
                                        foreach (System.Data.DataRow Pago in TablaPagos.Rows) {
                                                Bancos.Cheque Ch = new Lbl.Bancos.Cheque(Connection, (Lfx.Data.Row)Pago);
                                                if (this.DePago)
                                                        Ch.ReciboPago = this;
                                                else
                                                        Ch.ReciboCobro = this;
                                                if (this.DePago)
                                                        Pagos.Add(new Pago(Ch));
                                                else 
                                                        Cobros.Add(new Cobro(Ch));
                                        }
                                }

                                // Pagos con Tarjetas de Crédito y Débito
                                using (System.Data.DataTable TablaPagos = this.Connection.Select("SELECT id_cupon FROM tarjetas_cupones WHERE id_recibo=" + Id.ToString())) {
                                        foreach (System.Data.DataRow Pago in TablaPagos.Rows) {
                                                Pagos.Cupon Cp = new Pagos.Cupon(Connection, System.Convert.ToInt32(Pago["id_cupon"]));
                                                Cobros.Add(new Cobro(Cp));
                                        }
                                }

                                // Acreditaciones en cuenta regular (excepto caja diaria)
                                using (System.Data.DataTable TablaPagos = this.Connection.Select("SELECT * FROM cajas_movim WHERE auto=1 AND id_caja<>" + Lfx.Workspace.Master.CurrentConfig.Empresa.CajaDiaria.ToString() + " AND id_caja<>" + Lfx.Workspace.Master.CurrentConfig.Empresa.CajaCheques.ToString() + " AND id_recibo=" + this.Id.ToString())) {
                                        foreach (System.Data.DataRow Pago in TablaPagos.Rows) {
                                                if (this.DePago) {
                                                        Pago Pg = new Pago(this.Connection, Lbl.Pagos.TiposFormasDePago.Caja, Math.Abs(System.Convert.ToDecimal(Pago["importe"])));
                                                        Pg.Recibo = this;
                                                        Pg.CajaOrigen = new Cajas.Caja(Connection, System.Convert.ToInt32(Pago["id_caja"]));
                                                        Pagos.Add(Pg);
                                                } else {
                                                        Cobro Cb = new Cobro(this.Connection, Lbl.Pagos.TiposFormasDePago.Caja, System.Convert.ToDecimal(Pago["importe"]));
                                                        Cb.Recibo = this;
                                                        Cb.CajaDestino = new Cajas.Caja(Connection, System.Convert.ToInt32(Pago["id_caja"]));
                                                        Cobros.Add(Cb);
                                                }
                                        }
                                }

                                // Otros valores
                                using (System.Data.DataTable TablaPagos = this.Connection.Select("SELECT id_valor FROM pagos_valores WHERE id_recibo=" + Id.ToString())) {
                                        foreach (System.Data.DataRow Pago in TablaPagos.Rows) {
                                                Lbl.Pagos.Valor Vl = new Lbl.Pagos.Valor(Connection, System.Convert.ToInt32(Pago["id_valor"]));
                                                Vl.Recibo = this;
                                                if (this.DePago)
                                                        Pagos.Add(new Pago(Vl));
                                                else
                                                        Cobros.Add(new Cobro(Vl));
                                        }
                                }
                        }
                        base.OnLoad();
                }
示例#37
0
        public void ProcessRequest(HttpContext context)
        {
            string orderStatus    = context.Request["order_status"];
            string orderFromDate  = context.Request["order_from_date"];
            string orderToDate    = context.Request["order_to_date"];
            string orderId        = context.Request["order_id"];
            string supplierUserId = context.Request["supplier_user_id"];


            System.Text.StringBuilder sbSql = new System.Text.StringBuilder();
            sbSql.AppendFormat("Select ");


            sbSql.AppendFormat(" SupplierName as [商户名称],");
            sbSql.AppendFormat(" OrderId as [订单编号],");
            sbSql.AppendFormat(" OrderDate as [下单时间],");
            sbSql.AppendFormat(" BaseAmount as [产品结算金额],");
            sbSql.AppendFormat(" SaleAmount as [销售额],");
            sbSql.AppendFormat(" ServerAmount as [服务费=销售额-产品结算额],");
            sbSql.AppendFormat(" TransportFee as [代收运费],");
            sbSql.AppendFormat(" SettlementAmount as [结算金额=产品结算金额+代收运费],");
            sbSql.AppendFormat(" OrderStatus as [订单状态],");
            sbSql.AppendFormat(" [退款]=(case when IsRefund=0 then '无' when IsRefund=1 then '有' end) ");
            sbSql.AppendFormat(" from ZCJ_SupplierUnSettlement ");
            sbSql.AppendFormat(" Where Websiteowner='{0}'", bllMall.WebsiteOwner);

            if (!string.IsNullOrEmpty(supplierUserId))
            {
                sbSql.AppendFormat(" And SupplierUserId='{0}'", supplierUserId);
            }
            if (!string.IsNullOrEmpty(orderId))
            {
                sbSql.AppendFormat(" And OrderId='{0}'", orderId);
            }
            if (!string.IsNullOrEmpty(orderStatus))
            {
                if (orderStatus != "退款退货")
                {
                    sbSql.AppendFormat(" And OrderStatus='{0}'", orderStatus);
                }
                else
                {
                    sbSql.AppendFormat(" And IsRefund=1 ");
                }
            }
            if (!string.IsNullOrEmpty(orderFromDate))
            {
                sbSql.AppendFormat(" And OrderDate>='{0}'", orderFromDate);
            }
            if (!string.IsNullOrEmpty(orderToDate))
            {
                sbSql.AppendFormat(" And OrderDate<='{0}'", orderToDate);
            }



            //

            System.Data.DataTable dt = dt = ZentCloud.ZCBLLEngine.BLLBase.Query(sbSql.ToString()).Tables[0];

            DataLoadTool.ExportDataTable(dt, string.Format("{0}_{1}_data.xls", "未结算单", DateTime.Now.ToString()));
        }
 private static Type GetFieldByTypeFromDataColumn(System.Data.DataTable dataTable, string memberName)
 {
     return(dataTable.Columns.Contains(memberName) ? dataTable.Columns[memberName].DataType : null);
 }
示例#39
0
        private void getIndirectCost(string FACode)
        {
            BOQID.Rows.Clear();
            System.Data.DataTable dtIndirectCostCode = new System.Data.DataTable();
            dtIndirectCostCode.Columns.Add("CostCode");
            dtIndirectCostCode.Columns.Add("AR");
            dtIndirectCostCode.Columns.Add("Budget");

            System.Data.DataTable AMS = new System.Data.DataTable();
            AMS.Columns.Add("AM");
            AMS.Columns.Add("Father");


            Hashtable hp = new Hashtable();

            hp.Add("~p1", FACode);
            System.Data.DataTable dtFA = Program.objHrmsUI.getDataTableQryCode("DBOQ_IC_001", hp, "Fill Root");

            if (dtFA.Rows.Count > 0)
            {
                foreach (System.Data.DataRow drFA in dtFA.Rows)
                {
                    string AM     = drFA["Code"].ToString();
                    string Father = drFA["U_Father"].ToString();
                    while (AM != "0")
                    {
                        AMS.Rows.Add(AM, Father);
                        hp.Clear();
                        hp.Add("~p1", Father);
                        string strFather = Program.objHrmsUI.getQryString("DBOQ_IC_002", hp);

                        System.Data.DataTable dtFather = Program.objHrmsUI.getDataTable(strFather, "Father");
                        if (dtFather.Rows.Count > 0)
                        {
                            AM     = dtFather.Rows[0]["Code"].ToString();
                            Father = dtFather.Rows[0]["U_Father"].ToString();
                        }
                        else
                        {
                            Father = "0";
                            AM     = "Root";
                        }
                    }
                }
            }
            double indirectCostBudget = 0.00;
            double indirectCostActual = 0.00;

            foreach (System.Data.DataRow drAM in AMS.Rows)
            {
                hp.Clear();
                hp.Add("~p1", drAM["AM"].ToString());
                string strSqlAR = Program.objHrmsUI.getQryString("DBOQ_IC_003", hp);
                System.Data.DataTable dtRule = Program.objHrmsUI.getDataTable(strSqlAR, "Allocation Rule");
                if (dtRule.Rows.Count > 0)
                {
                    foreach (System.Data.DataRow drAR in dtRule.Rows)
                    {
                        hp.Clear();
                        hp.Add("~p1", drAR["AR"].ToString());
                        string strCosts = Program.objHrmsUI.getQryString("DBOQ_IC_004", hp);
                        System.Data.DataTable dtCostCodes = Program.objHrmsUI.getDataTable(strCosts, "Indirect Cost Codes");
                        foreach (System.Data.DataRow drCostCode in dtCostCodes.Rows)
                        {
                            BOQID.Rows.Add(1);
                            BOQID.SetValue("CostCode", BOQID.Rows.Count - 1, drCostCode["code"].ToString());
                            BOQID.SetValue("STD", BOQID.Rows.Count - 1, Convert.ToDateTime(drCostCode["U_WBSStd"]));
                            BOQID.SetValue("ETD", BOQID.Rows.Count - 1, Convert.ToDateTime(drCostCode["U_WBSED"]));
                            BOQID.SetValue("WBL", BOQID.Rows.Count - 1, drCostCode["U_WBSLevel"].ToString());
                            BOQID.SetValue("WBD", BOQID.Rows.Count - 1, drCostCode["U_WBSDscr"].ToString());
                            double indirectCost    = getIndirectACt(drCostCode["code"].ToString(), FACode);
                            double indirectBgtCost = Convert.ToDouble(drCostCode["U_BgtCost"]) * (Convert.ToDouble(drAR["AP"]) / 100.00);

                            BOQID.SetValue("BGTC", BOQID.Rows.Count - 1, indirectBgtCost);
                            BOQID.SetValue("ACTC", BOQID.Rows.Count - 1, indirectCost);
                            BOQID.SetValue("Remarks", BOQID.Rows.Count - 1, drCostCode["U_Remarks"].ToString());

                            indirectCostActual += indirectCost;
                            indirectCostBudget += indirectBgtCost;
                        }
                    }
                }
            }
            BOQH.SetValue("ICB", 0, indirectCostBudget);
            BOQH.SetValue("ICA", 0, indirectCostActual);

            BOQH.SetValue("TCB", 0, indirectCostBudget + Convert.ToDouble(BOQH.GetValue("DCB", 0)));
            BOQH.SetValue("TCA", 0, indirectCostActual + Convert.ToDouble(BOQH.GetValue("DCA", 0)));

            mtIC.LoadFromDataSource();
        }
示例#40
0
 public string ToGridJson(System.Data.DataTable dt, int totalCount)
 {
     return(ToGridJson(dt, totalCount, null));
 }
示例#41
0
 public string ToTreeGridJson(System.Data.DataTable dt, string IdName, string _parentIdName)
 {
     return(ToTreeGridJson(dt, IdName, _parentIdName, null));
 }
        public static string ToHtmlTable(this System.Data.DataTable datatable, object tableAttributes = null, object trAttributes = null, object tdAttributes = null, HtmlTableSetting HTMLTableSetting = null)
        {
            var htmltablegenerater = HtmlTableGeneraterFactory.CreateInstance(tableAttributes, trAttributes, tdAttributes, HTMLTableSetting);

            return(htmltablegenerater.ToHtmlTableByDataTable(datatable));
        }
示例#43
0
 public DataPreviewController(System.Data.DataTable dt)
 {
     this.dt = dt;
     Initialize(true);
 }
示例#44
0
 private void SearchB_Click(object sender, RoutedEventArgs e)
 {
     Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate()
     {
         if (CByName.IsChecked == true)
         {
             Pb.Visibility = Visibility.Visible;
             mT.Clear();
             mA.Dispose();
             mA = new MySql.Data.MySqlClient.MySqlDataAdapter("SELECT * FROM medics WHERE `Name` = '" + SearchBox.Text + "'ORDER BY Name", Database.DataHolder.MySqlConnection);
             mT = new System.Data.DataTable();
             mA.Fill(mT);
             if (mA == null)
             {
                 return;
             }
             if (mT.Rows.Count == 0)
             {
                 mT.Rows.Add(new object[mT.Columns.Count]);
             }
             DataGrid.ItemsSource = mT.DefaultView;
             Pb.Visibility        = Visibility.Hidden;
         }
         else if (CByBar.IsChecked == true)
         {
             Pb.Visibility = Visibility.Visible;
             mT.Clear();
             mA.Dispose();
             mA = new MySql.Data.MySqlClient.MySqlDataAdapter("SELECT * FROM medics WHERE `Barcode` = '" + SearchBox.Text + "'ORDER BY Name", Database.DataHolder.MySqlConnection);
             mT = new System.Data.DataTable();
             mA.Fill(mT);
             if (mA == null)
             {
                 return;
             }
             if (mT.Rows.Count == 0)
             {
                 mT.Rows.Add(new object[mT.Columns.Count]);
             }
             DataGrid.ItemsSource = mT.DefaultView;
             Pb.Visibility        = Visibility.Hidden;
         }
         else if (CBySub.IsChecked == true)
         {
             Pb.Visibility = Visibility.Visible;
             mT.Clear();
             mA.Dispose();
             mA = new MySql.Data.MySqlClient.MySqlDataAdapter("SELECT * FROM medics WHERE `ScientificName` = '" + SearchBox.Text + "'ORDER BY Name", Database.DataHolder.MySqlConnection);
             mT = new System.Data.DataTable();
             mA.Fill(mT);
             if (mA == null)
             {
                 return;
             }
             if (mT.Rows.Count == 0)
             {
                 mT.Rows.Add(new object[mT.Columns.Count]);
             }
             DataGrid.ItemsSource = mT.DefaultView;
             Pb.Visibility        = Visibility.Hidden;
         }
     });
 }
示例#45
0
 public override void CreateChildRight(System.Data.DataTable _rightData, decimal _fqxid, decimal _menuid, decimal _fxh)
 {
     base.AddRightData(_rightData, _fqxid + 10, "全局元数据设置", _fxh + 10, _menuid, _fqxid);
     base.AddRightData(_rightData, _fqxid + 20, "节点元数据设置", _fxh + 20, _menuid, _fqxid);
     base.AddRightData(_rightData, _fqxid + 30, "指标定义", _fxh + 30, _menuid, _fqxid);
 }
示例#46
0
        private async void onOkImportExec(object _param)
        {
            if (string.IsNullOrEmpty(FileNameImport))
            {
                showError  = App.Current.FindResource("please_select_file").ToString() + " csv.";
                IsVisError = System.Windows.Visibility.Visible;
                return;
            }
            else
            {
                showError  = string.Empty;
                IsVisError = System.Windows.Visibility.Collapsed;
            }
            bool _isExec = true;

            if (_lstColumn != _strColumnName)
            {
                showError  = App.Current.FindResource("content_file_invalid").ToString();
                IsVisError = System.Windows.Visibility.Visible;
                return;
            }
            else
            {
                showError  = string.Empty;
                IsVisError = System.Windows.Visibility.Collapsed;
            }
            if (OptionsImport == TypeImport.Overwrite)
            {
                ModernDialog mdd = new ModernDialog();
                mdd.Buttons               = new System.Windows.Controls.Button[] { mdd.OkButton, mdd.CancelButton, };
                mdd.OkButton.TabIndex     = 0;
                mdd.OkButton.Content      = App.Current.FindResource("ok").ToString();
                mdd.CancelButton.TabIndex = 1;
                mdd.CancelButton.Content  = App.Current.FindResource("cancel").ToString();
                mdd.TabIndex              = -1;
                mdd.Height  = 200;
                mdd.Title   = App.Current.FindResource("notification").ToString();
                mdd.Content = App.Current.FindResource("confirm_choose_del").ToString();
                mdd.OkButton.Focus();
                mdd.ShowDialog();
                if (mdd.MessageBoxResult != System.Windows.MessageBoxResult.OK)
                {
                    _isExec = false;
                }
            }
            else
            {
                ModernDialog mdd = new ModernDialog();
                mdd.Buttons               = new System.Windows.Controls.Button[] { mdd.OkButton, mdd.CancelButton, };
                mdd.OkButton.TabIndex     = 0;
                mdd.OkButton.Content      = App.Current.FindResource("ok").ToString();
                mdd.CancelButton.TabIndex = 1;
                mdd.CancelButton.Content  = App.Current.FindResource("cancel").ToString();
                mdd.TabIndex              = -1;
                mdd.Height  = 200;
                mdd.Title   = App.Current.FindResource("notification").ToString();
                mdd.Content = App.Current.FindResource("confirm_import").ToString();
                mdd.OkButton.Focus();
                mdd.ShowDialog();
                if (mdd.MessageBoxResult != System.Windows.MessageBoxResult.OK)
                {
                    _isExec = false;
                }
                System.Data.DataTable _dt = bus_tb_category.GetCatagorySetting("");
                if (_dt.Rows.Count > 0)
                {
                    foreach (System.Data.DataRow _dr in _dt.Rows)
                    {
                        _lstCat.Add(_dr["CategoryName"].ToString());
                    }
                }
            }
            if (_isExec)
            {
                IsShowProgress  = true;
                IsVisibleButton = System.Windows.Visibility.Collapsed;
                string _fileImport = FileNameImport;
                var    slowTask    = Task <string> .Factory.StartNew(() => this._ImportFromCSV(System.IO.Path.GetFileNameWithoutExtension(_fileImport), _fileImport));

                await slowTask;
                IsShowProgress  = false;
                IsVisibleButton = System.Windows.Visibility.Visible;
                if (slowTask.Result.ToString() == "Success")
                {
                    string _strText = App.Current.FindResource("import_success").ToString().Replace("$$", App.Current.FindResource("cash_register").ToString());
                    System.Windows.MessageBox.Show(_strText, "Successfull");
                    FileInfo fi = new System.IO.FileInfo(_fileImport);
                    File.Delete(fi.DirectoryName.ToString() + "\\schema.ini");
                    StaticClass.GeneralClass.app_settings["appIsRestart"] = true;
                    Model.UpgradeDatabase.updateAppSetting(StaticClass.GeneralClass.app_settings);
                    System.Diagnostics.Process.Start(System.Windows.Application.ResourceAssembly.Location);
                    System.Windows.Application.Current.Shutdown();
                }
                else
                {
                    System.Windows.MessageBox.Show(App.Current.FindResource("err_import_tryagain").ToString(), "Error");
                    FileInfo fi = new System.IO.FileInfo(_fileImport);
                    File.Delete(fi.DirectoryName.ToString() + "\\schema.ini");
                }
            }
        }
示例#47
0
                public static decimal DescancelarImpagos(Lbl.Personas.Persona cliente, Lbl.Comprobantes.ColeccionComprobanteImporte listaComprob, Lbl.Comprobantes.Comprobante comprob, decimal importe)
                {
                        // Doy los comprob por cancelados
                        decimal TotalACancelar = Math.Abs(importe);

                        //"Descancelo" comprob
                        if (listaComprob != null && listaComprob.Count > 0) {
                                // Si hay una lista de comprob, los descancelo
                                foreach (ComprobanteImporte CompImp in listaComprob) {
                                        // Intento descancelar todo
                                        decimal Cancelando = CompImp.Importe;

                                        // Si mes demasiado, hago un pago parcial
                                        if (Cancelando > CompImp.Comprobante.ImporteCancelado)
                                                Cancelando = CompImp.Comprobante.ImporteCancelado;

                                        // Si se acabó la plata, hago un pago parcial
                                        if (Cancelando > TotalACancelar)
                                                Cancelando = TotalACancelar;

                                        // Si alcanzo a cancelar algo, lo asiento
                                        if (Cancelando > 0)
                                                CompImp.Comprobante.DescancelarImporte(Cancelando, comprob);

                                        TotalACancelar = TotalACancelar - Cancelando;
                                        if (TotalACancelar == 0)
                                                break;
                                }
                        }

                        if (TotalACancelar > 0) {
                                // Si queda más saldo, sigo buscando facturas a descancelar
                                qGen.Select SelFacConSaldo = new qGen.Select("comprob");
                                SelFacConSaldo.WhereClause = new qGen.Where();
                                SelFacConSaldo.WhereClause.AddWithValue("impresa", qGen.ComparisonOperators.NotEqual, 0);
                                SelFacConSaldo.WhereClause.AddWithValue("anulada", 0);
                                SelFacConSaldo.WhereClause.AddWithValue("numero", qGen.ComparisonOperators.GreaterThan, 0);
                                SelFacConSaldo.WhereClause.AddWithValue("id_formapago", qGen.ComparisonOperators.In, new int[] { 1, 3, 99 });
                                SelFacConSaldo.WhereClause.AddWithValue("cancelado", qGen.ComparisonOperators.GreaterThan, 0);
                                SelFacConSaldo.WhereClause.AddWithValue("id_cliente", cliente.Id);
                                SelFacConSaldo.WhereClause.AddWithValue("tipo_fac", qGen.ComparisonOperators.In, new string[] { "FA", "FB", "FC", "FE", "FM", "NDA", "NDB", "NDC", "NDE", "NDM" });
                                if (importe > 0) {
                                        // Cancelo facturas y ND regulares
                                        SelFacConSaldo.WhereClause.AddWithValue("compra", 0);
                                } else {
                                        // Cancelo facturas y de compra
                                        SelFacConSaldo.WhereClause.AddWithValue("compra", qGen.ComparisonOperators.NotEqual, 0);
                                }
                                SelFacConSaldo.Order = "id_comprob DESC";
                                using (System.Data.DataTable FacturasConSaldo = cliente.Connection.Select(SelFacConSaldo)) {
                                        foreach (System.Data.DataRow Factura in FacturasConSaldo.Rows) {
                                                Lbl.Comprobantes.ComprobanteConArticulos Fact = new ComprobanteConArticulos(cliente.Connection, (Lfx.Data.Row)Factura);

                                                decimal SaldoFactura = Fact.ImporteCancelado;
                                                decimal ImporteASaldar = SaldoFactura;

                                                if (ImporteASaldar > TotalACancelar)
                                                        ImporteASaldar = TotalACancelar;

                                                Fact.DescancelarImporte(ImporteASaldar, comprob);

                                                TotalACancelar -= ImporteASaldar;

                                                if (TotalACancelar <= 0)
                                                        break;
                                        }
                                }
                        }

                        /* if (TotalACancelar > 0) {
                                Lbl.Cajas.Concepto Conc;
                                if (comprob is Recibo)
                                        Conc = ((Recibo)comprob).Concepto;
                                else
                                        Conc = Lbl.Cajas.Concepto.AjustesYMovimientos;
                                cliente.CuentaCorriente.Movimiento(true, Conc, "Anulación de " + comprob.ToString(), TotalACancelar * DireccionCtaCte, comprob.Obs, comprob as Lbl.Comprobantes.ComprobanteConArticulos, comprob as Lbl.Comprobantes.Recibo, null);
                                TotalACancelar = 0;
                        } */

                        // Devuelvo el sobrante
                        return TotalACancelar;
                }
示例#48
0
 public ListarFiltrarDatosRequest(string sNombreSP, System.Data.DataTable DT_Parametros, string sMsjError)
 {
     this.sNombreSP     = sNombreSP;
     this.DT_Parametros = DT_Parametros;
     this.sMsjError     = sMsjError;
 }
示例#49
0
        protected override void Execute(CodeActivityContext context)
        {
            //Range xlActiveRange = base.worksheet.UsedRange;
            var ignoreEmptyRows = (IgnoreEmptyRows != null ? IgnoreEmptyRows.Get(context) : false);
            var useHeaderRow = (UseHeaderRow != null? UseHeaderRow.Get(context)  : false);
            base.Execute(context);
            var cells = Cells.Get(context);
            Microsoft.Office.Interop.Excel.Range range = null;
            if (string.IsNullOrEmpty(cells))
            {
                range = base.worksheet.UsedRange;

                //Range last = base.worksheet.Cells.SpecialCells(XlCellType.xlCellTypeLastCell, Type.Missing);
                //Range range = base.worksheet.get_Range("A1", last);

                //int lastUsedRow = range.Row;
                //int lastUsedColumn = range.Column;
            }
            else
            {
                if (!cells.Contains(":")) throw new ArgumentException("Cell should contain a range dedenition, meaning it should contain a colon :");
                range = base.worksheet.get_Range(cells);
            }
            //object[,] valueArray = (object[,])range.Value;
            object[,] valueArray = (object[,])range.get_Value(Microsoft.Office.Interop.Excel.XlRangeValueDataType.xlRangeValueDefault);

            var o = ProcessObjects(useHeaderRow, ignoreEmptyRows, valueArray);

            System.Data.DataTable dt = o as System.Data.DataTable;
            dt.TableName = base.worksheet.Name;
            if (string.IsNullOrEmpty(dt.TableName)) { dt.TableName = "Unknown";  }
            DataTable.Set(context, dt);

            //dt.AsEnumerable();

            //string json = Newtonsoft.Json.JsonConvert.SerializeObject(dt, Newtonsoft.Json.Formatting.Indented);
            ////context.SetValue(Json, JObject.Parse(json));
            //context.SetValue(Json, JArray.Parse(json));

            if (ClearFormats.Get(context))
            {
                worksheet.Columns.ClearFormats();
                worksheet.Rows.ClearFormats();
            }

            if (lastUsedColumn!=null || lastUsedRow!=null)
            {

                // Unhide All Cells and clear formats

                // Detect Last used Row - Ignore cells that contains formulas that result in blank values
                //int lastRowIgnoreFormulas = worksheet.Cells.Find(
                //                "*",
                //                System.Reflection.Missing.Value,
                //                XlFindLookIn.xlValues,
                //                XlLookAt.xlWhole,
                //                XlSearchOrder.xlByRows,
                //                XlSearchDirection.xlPrevious,
                //                false,
                //                System.Reflection.Missing.Value,
                //                System.Reflection.Missing.Value).Row;
                // Detect Last Used Column  - Ignore cells that contains formulas that result in blank values
                //int lastColIgnoreFormulas = worksheet.Cells.Find(
                //                "*",
                //System.Reflection.Missing.Value,
                //                System.Reflection.Missing.Value,
                //                System.Reflection.Missing.Value,
                //                XlSearchOrder.xlByColumns,
                //                XlSearchDirection.xlPrevious,
                //                false,
                //                System.Reflection.Missing.Value,
                //                System.Reflection.Missing.Value).Column;

                // Detect Last used Row / Column - Including cells that contains formulas that result in blank values
                //int lastColIncludeFormulas = worksheet.UsedRange.Columns.Count;
                //int lastColIncludeFormulas = worksheet.UsedRange.Rows.Count;

                //range = base.worksheet.UsedRange;
                int _lastUsedColumn = worksheet.UsedRange.Columns.Count;
                int _lastUsedRow = worksheet.UsedRange.Rows.Count;
                if (lastUsedColumn != null) context.SetValue(lastUsedColumn, ColumnIndexToColumnLetter(_lastUsedColumn));
                if (lastUsedRow != null) context.SetValue(lastUsedRow, _lastUsedRow);
            }
        }
示例#50
0
 public UIHeader Slider(System.Data.DataTable sliders)
 {
     meta.Put("type", "Slider").Put("data", new WebMeta().Put("data", sliders));
     return(this);
 }
示例#51
0
        void LoadBind(string GetType)
        {
            int    PageIndex   = Convert.ToInt32(Request.QueryString["page"]);
            int    PageSize    = Convert.ToInt32(Request.QueryString["limit"]);
            int    PageStart   = Convert.ToInt32(Request.QueryString["start"]);
            string Order       = Request.QueryString["order"];
            string OSrderDir   = Request.QueryString["orderDir"];
            var    WhereValues = Request.QueryString["WhereValues"];

            if (GetType == "GetDataList")
            {
                System.Data.DataTable dt = (WhereValues == null ? null : BLL.JsonHelper.DeserializeJsonToObject <System.Data.DataTable>(WhereValues));//条件数据
                Response.Write(tableModel.GetDataListJson(dt, PageStart, PageIndex, PageSize, " " + Order + " " + OSrderDir));
                Response.End();
            }
            else if (GetType == "SaveFromData")
            {
                var            ChoiceValue = Request.QueryString["ChoiceValue"];
                var            FromValues  = Server.UrlDecode(Request.QueryString["FromValues"]);
                BLL.ObjectData ModelData   = new BLL.ObjectData(tableModel.TableModel.TableName);
                ModelData.SetValues(FromValues);//表单数据
                var RowNum   = true;
                var CodeJson = "";
                if (ChoiceValue != null && ChoiceValue != "")//修改
                {
                    RowNum = tableModel.UpdateModel(ModelData, ChoiceValue);
                    if (RowNum)
                    {
                        CodeJson = "[{\"code\":100}]";
                    }
                    else
                    {
                        CodeJson = "[{\"code\":105}]";
                    }
                }
                else//添加
                {
                    var ItemID = tableModel.InsertModel(ModelData);
                    if (string.IsNullOrWhiteSpace(ItemID))
                    {
                        CodeJson = "[{\"code\":100}]";
                    }
                    else
                    {
                        CodeJson = "[{\"code\":105}]";
                    }
                }
                Response.Write(CodeJson);
                Response.End();
            }
            else if (GetType == "GetDataView")
            {
                var ChoiceValue = Request.QueryString["ChoiceValue"];
                Response.Write(tableModel.GetDataViewJson(ChoiceValue));
                Response.End();
            }
            else if (GetType == "BntOperation")
            {
                var ChoiceValue = Request["ChoiceValue"];
                if (!string.IsNullOrWhiteSpace(ChoiceValue))
                {
                    Response.Write(tableModel.DeleteData(ChoiceValue));
                }
                else
                {
                    Response.Write("False");
                }
                Response.End();
            }
            else if (GetType == "GetFieldKeyValue")
            {
                Dictionary <string, string> data = new Dictionary <string, string> {
                };
                for (int i = 0; i < Request.QueryString.Count; i++)
                {
                    data.Add(Request.QueryString.Keys[i].ToString(), Request.QueryString[i].ToString());
                }
                if (data.Count > 0)
                {
                    Response.Write(tableModel.GetFieldKeyValue(data));
                }
                else
                {
                    Response.Write("False");
                }
                Response.End();
            }
        }
        protected void MemberServicesGrid_OnItemCommand(Object sender, Telerik.Web.UI.GridCommandEventArgs eventArgs)
        {
            if (MercuryApplication == null)
            {
                return;
            }


            System.Data.DataTable detailTable = null;

            Telerik.Web.UI.RadToolBar gridToolBar = null;

            Boolean success = false;

            String postScript = String.Empty;


            switch (eventArgs.CommandName)
            {
            case "ExpandCollapse":

                #region Expand/Collapse

                Telerik.Web.UI.GridDataItem gridItem = (Telerik.Web.UI.GridDataItem)eventArgs.Item;

                Int64 memberServiceId;

                if (Int64.TryParse(gridItem["MemberServiceId"].Text, out memberServiceId))
                {
                    switch (gridItem["ServiceType"].Text)
                    {
                    case "Singleton":

                        #region Singleton Detail Table

                        detailTable = MemberServicesGrid_DataTableSingletonTable;

                        detailTable.Rows.Clear();

                        List <Mercury.Server.Application.MemberServiceDetailSingleton> detailSingletons;

                        detailSingletons = MercuryApplication.MemberServiceDetailSingletonGet(memberServiceId);

                        foreach (Mercury.Server.Application.MemberServiceDetailSingleton currentDetail in detailSingletons)
                        {
                            // String principalDiagnosisInformation = "<span title=\"" + MercuryApplication.DiagnosisDescription (currentDetail.PrincipalDiagnosisCode, currentDetail.PrincipalDiagnosisVersion) + "\">" + currentDetail.PrincipalDiagnosisCode + "</span>";

                            // String diagnosisInformation = "<span title=\"" + MercuryApplication.DiagnosisDescription (currentDetail.DiagnosisCode, currentDetail.DiagnosisVersion) + "\">" + currentDetail.DiagnosisCode + "</span>";

                            String principalDiagnosisInformation = CommonFunctions.DiagnosisDescription(MercuryApplication, currentDetail.PrincipalDiagnosisCode, currentDetail.PrincipalDiagnosisVersion);

                            String diagnosisInformation = CommonFunctions.DiagnosisDescription(MercuryApplication, currentDetail.DiagnosisCode, currentDetail.DiagnosisVersion);


                            String revenueCodeInformation = "<span title=\"" + MercuryApplication.RevenueCodeDescription(currentDetail.RevenueCode) + "\">" + currentDetail.RevenueCode + "</span>";

                            String procedureCodeInformation = "<span title=\"" + MercuryApplication.ProcedureCodeDescription(currentDetail.ProcedureCode) + "\">" + currentDetail.ProcedureCode + "</span>";

                            String billTypeInformation = "<span title=\"" + MercuryApplication.BillTypeDescription(currentDetail.BillType) + "\">" + currentDetail.BillType + "</span>";

                            String icd9ProcedureCodeInformation = "<span title=\"" + MercuryApplication.Icd9ProcedureCodeDescription(currentDetail.Icd9ProcedureCode) + "\">" + currentDetail.Icd9ProcedureCode + "</span>";

                            detailTable.Rows.Add(

                                currentDetail.MemberServiceId.ToString(),

                                currentDetail.SingletonDefinitionId.ToString(),

                                currentDetail.EventDate.ToString("MM/dd/yyyy"),

                                currentDetail.ExternalClaimId,

                                currentDetail.ClaimLine.ToString(),

                                currentDetail.ClaimType,

                                billTypeInformation,

                                principalDiagnosisInformation,

                                diagnosisInformation,

                                icd9ProcedureCodeInformation,

                                currentDetail.LocationCode,

                                revenueCodeInformation,

                                procedureCodeInformation,

                                currentDetail.ModifierCode,

                                currentDetail.SpecialtyName,

                                currentDetail.IsPcpClaim.ToString(),

                                currentDetail.NdcCode,

                                currentDetail.Units.ToString(),

                                currentDetail.TherapeuticClassification,

                                currentDetail.LabLoincCode,

                                currentDetail.LabValue.ToString(),

                                currentDetail.Description

                                );
                        }

                        MemberServicesGrid_DataTableSingletonTable = detailTable;

                        MemberServicesGrid.MasterTableView.DetailTables[0].DataSource = detailTable;


                        #endregion

                        break;

                    case "Set":

                        #region Set Detail Table

                        detailTable = MemberServicesGrid_DataTableSetTable;

                        detailTable.Rows.Clear();

                        List <Mercury.Server.Application.MemberServiceDetailSet> detailSets;

                        detailSets = MercuryApplication.MemberServiceDetailSetGet(memberServiceId);

                        foreach (Mercury.Server.Application.MemberServiceDetailSet currentDetail in detailSets)
                        {
                            detailTable.Rows.Add(

                                currentDetail.MemberServiceId.ToString(),

                                currentDetail.SetDefinitionId.ToString(),

                                currentDetail.DetailMemberServiceId.ToString(),

                                currentDetail.EventDate.ToString("MM/dd/yyyy"),

                                currentDetail.ServiceName,

                                currentDetail.ServiceType.ToString()

                                );
                        }

                        MemberServicesGrid_DataTableSetTable = detailTable;

                        MemberServicesGrid.MasterTableView.DetailTables[1].DataSource = detailTable;

                        #endregion

                        break;
                    }
                }

                #endregion

                break;

            case "MemberServiceAdd":

                #region Member Service Add

                gridToolBar = (Telerik.Web.UI.RadToolBar)eventArgs.Item.FindControl("MemberServiceToolbar");

                if (gridToolBar != null)
                {
                    Telerik.Web.UI.RadComboBox MemberServiceSelection = (Telerik.Web.UI.RadComboBox)(gridToolBar.Items[2].FindControl("MemberServiceSelection"));

                    Telerik.Web.UI.RadDateInput MemberServiceEventDate = (Telerik.Web.UI.RadDateInput)(gridToolBar.Items[2].FindControl("MemberServiceEventDate"));

                    if (MemberServiceSelection != null)
                    {
                        if (!String.IsNullOrEmpty(MemberServiceSelection.SelectedValue))
                        {
                            if (MemberServiceEventDate.SelectedDate.HasValue)
                            {
                                success = MercuryApplication.MemberServiceAddManual(Member.Id, Convert.ToInt64(MemberServiceSelection.SelectedValue), MemberServiceEventDate.SelectedDate.Value);

                                if (!success)
                                {
                                    postScript = ("alert (\"" + MercuryApplication.LastException.Message.Replace("\"", "\\") + "\");");
                                }

                                else
                                {
                                    MemberServicesGrid_Count = 0;

                                    MemberServicesGrid.DataSource = null;

                                    MemberServicesGrid.Rebind();
                                }
                            }

                            else
                            {
                                postScript = ("alert (\"Event Date of Service is Required.\");");
                            }
                        }

                        else
                        {
                            postScript = ("alert (\"No Service Selected for Manual Add.\");");
                        }
                    }

                    else
                    {
                        postScript = ("alert (\"Internal Error: Unable to Find Control MemberServiceSelection.\");");
                    }


                    if ((TelerikAjaxManager != null) && (!String.IsNullOrEmpty(postScript)))
                    {
                        TelerikAjaxManager.ResponseScripts.Add(postScript);
                    }
                }

                #endregion

                break;

            default:

                System.Diagnostics.Debug.WriteLine("MemberServicesGrid_OnItemCommand: " + eventArgs.CommandSource + " " + eventArgs.CommandName + " (" + eventArgs.CommandArgument + ")");

                break;
            }

            return;
        }
示例#53
0
 /// <summary>
 /// Update
 /// </summary>
 /// <param name="dataTable"></param>
 /// <param name="queryText"></param>
 /// <param name="commandType"></param>
 /// <param name="getSchemaTable"></param>
 /// <param name="values"></param>
 /// <returns></returns>
 public override System.Data.Common.DbCommand UpdateQueryItem(
     ref System.Data.DataTable dataTable, string queryText, System.Data.CommandType commandType, bool getSchemaTable, params System.Data.Common.DbParameter[] values)
 {
     return(base.UpdateQueryItem(ref dataTable, queryText, commandType, getSchemaTable, values));
 }
        protected void MemberServicesGrid_OnNeedDataSource(Object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs eventArgs)
        {
            if (MercuryApplication == null)
            {
                return;
            }

            System.Data.DataTable memberServicesDataTable = MemberServicesGrid_DataTable;

            if (!eventArgs.IsFromDetailTable)
            {
                switch (eventArgs.RebindReason)
                {
                case Telerik.Web.UI.GridRebindReason.InitialLoad:

                    #region Initialize Grid

                    MemberServicesGrid_Count = 0;

                    MemberServicesGrid_CurrentPage = 0;

                    MemberServicesGrid_PageSize = 10;


                    MemberServicesGrid.CurrentPageIndex = MemberServicesGrid_CurrentPage;

                    MemberServicesGrid.PageSize = MemberServicesGrid_PageSize;

                    MemberServicesGrid.VirtualItemCount = MemberServicesGrid_Count;

                    #endregion

                    break;

                case Telerik.Web.UI.GridRebindReason.PostbackViewStateNotPersisted:

                    #region Restore Grid State

                    MemberServicesGrid.CurrentPageIndex = MemberServicesGrid_CurrentPage;

                    MemberServicesGrid.PageSize = MemberServicesGrid_PageSize;

                    MemberServicesGrid.VirtualItemCount = MemberServicesGrid_Count;


                    if (MemberServiceToolbar != null)
                    {
                        Telerik.Web.UI.RadComboBox MemberServiceSelection = (Telerik.Web.UI.RadComboBox)MemberServiceToolbar.Items[2].FindControl("MemberServiceSelection");

                        if (MemberServiceSelection != null)
                        {
                            MemberServiceSelection_SelectedValue = MemberServiceSelection.SelectedValue;
                        }

                        Telerik.Web.UI.RadDateInput MemberServiceEventDate = (Telerik.Web.UI.RadDateInput)MemberServiceToolbar.Items[2].FindControl("MemberServiceEventDate");

                        if (MemberServiceEventDate != null)
                        {
                            MemberServiceEventDate_SelectedDate = MemberServiceEventDate.SelectedDate;
                        }
                    }

                    #endregion

                    break;

                case Telerik.Web.UI.GridRebindReason.ExplicitRebind:

                case Telerik.Web.UI.GridRebindReason.PostBackEvent:

                    #region Initialize Toolbar and Security

                    if (MemberServiceToolbar != null)
                    {
                        MemberServiceToolbar.Items[1].Visible = MercuryApplication.HasEnvironmentPermission(Mercury.Server.EnvironmentPermissions.MemberServiceManage);

                        MemberServiceToolbar.Items[2].Visible = MercuryApplication.HasEnvironmentPermission(Mercury.Server.EnvironmentPermissions.MemberServiceManage);
                    }

                    #endregion

                    #region Rebind Grid

                    if (Member == null)
                    {
                        memberServicesDataTable.Rows.Clear();
                    }

                    else
                    {
                        if (MemberServicesGrid_Count == 0)
                        {
                            MemberServicesGrid_Count = Convert.ToInt32(MercuryApplication.MemberServicesGetCount(Member.Id, MemberServiceShowHidden));

                            MemberServicesGrid.VirtualItemCount = MemberServicesGrid_Count;
                        }

                        MemberServicesGrid_PageSize = MemberServicesGrid.PageSize;

                        MemberServicesGrid_CurrentPage = MemberServicesGrid.CurrentPageIndex;

                        memberServicesDataTable.Rows.Clear();

                        List <Mercury.Server.Application.MemberService> memberServices;

                        memberServices = MercuryApplication.MemberServicesGetByPage(Member.Id, (MemberServicesGrid.CurrentPageIndex) * MemberServicesGrid.PageSize + 1, MemberServicesGrid.PageSize, MemberServiceShowHidden);

                        foreach (Mercury.Server.Application.MemberService currentService in memberServices)
                        {
                            memberServicesDataTable.Rows.Add(

                                currentService.Id.ToString(),

                                currentService.Service.Name,

                                currentService.Service.ServiceType,

                                currentService.EventDate.ToString("MM/dd/yyyy"),

                                currentService.AddedManually.ToString(),

                                currentService.CreateAccountInfo.UserAccountName,

                                currentService.CreateAccountInfo.ActionDate.ToString("MM/dd/yyyy")

                                );
                        }
                    }

                    #endregion

                    break;

                default:

                    System.Diagnostics.Debug.WriteLine(eventArgs.RebindReason + " [" + eventArgs.IsFromDetailTable.ToString() + "]");

                    break;
                }

                MemberServicesGrid_DataTable = memberServicesDataTable;

                MemberServicesGrid.DataSource = MemberServicesGrid_DataTable;

                MemberServicesGrid.MasterTableView.DetailTables[0].DataSource = (MemberServicesGrid_DataTableSingletonTable.Rows.Count != 0) ? MemberServicesGrid_DataTableSingletonTable : null;

                MemberServicesGrid.MasterTableView.DetailTables[1].DataSource = (MemberServicesGrid_DataTableSetTable.Rows.Count != 0) ? MemberServicesGrid_DataTableSetTable : null;
            }

            return;
        }
示例#55
0
 public void ProcessDataTable(System.Data.DataTable dt)
 {
     throw new NotImplementedException();
 }
示例#56
0
        public MainWindow()
        {
            conn = new OleDbConnection();
            conn.ConnectionString = "PROVIDER = Microsoft.ACE.OLEDB.12.0; Data Source = Database.accdb";
            InitializeComponent();

            textb1.Text = @"    They were taken by the protectors of Kronos. The GAStech getting together with was infiltrated by POK users posing as caterers. POK users who worked for GAStech were able to organise this as they were involved in the organization of the catering for the event. These employees may have been involved with the Asterian people’s army, a paramilitary organization involved in the drugs trade as indicated by the contamination of the GAStech computers with a virus that produces Asterian People's Army themed spam ( using their magazine title “ARISE”). 

    The employees have been kidnapped, but not by the POK. The Asterian Peoples Army (APA) traffics drugs and Carmine Bodr0gi sold drugs for them and was arrested. His relative Loreto Bodrogi, may have been susceptible to compromising himself and his colleagues due to criminal pressure ( due to the arrest), and supplied the APA with the necessary information to organise the kidnapping and also access to GAStech computer system. The computers of the GAStech employee who appear to have been sending pro Kronos defence messages, have been deliberately infected with a virus to create them appear to be POK sympathizers a complete week prior to the kidnap. The motive is ransom for profit purely.";
            textb2.Text = @"    They were taken by the protectors of Kronos. The GAStech getting together with was infiltrated by POK users posing as caterers. POK users who worked for GAStech were able to organise this as they were involved in the organization of the catering for the event. These employees may have been involved with the Asterian people’s army, a paramilitary organization involved in the drugs trade as indicated by the contamination of the GAStech computers with a virus that produces Asterian People's Army themed spam ( using their magazine title “ARISE”).";
            textb3.Text = @"    The employees have been kidnapped, but not by the POK. The Asterian Peoples Army (APA) traffics drugs and Carmine Bodr0gi sold drugs for them and was arrested. His relative Loreto Bodrogi, may have been susceptible to compromising himself and his colleagues due to criminal pressure ( due to the arrest), and supplied the APA with the necessary information to organise the kidnapping and also access to GAStech computer system. The computers of the GAStech employee who appear to have been sending pro Kronos defence messages, have been deliberately infected with a virus to create them appear to be POK sympathizers a complete week prior to the kidnap. The motive is ransom for profit purely.";
            System.Data.DataTable dt = new System.Data.DataTable();
            conn.Open();
            cmd     = new OleDbCommand("SELECT * FROM articles ORDER BY ID", conn);
            adapter = new OleDbDataAdapter(cmd);
            adapter.Fill(dt);
            conn.Close();

            myGrid.ItemsSource = dt.DefaultView;
            myGrid.Items.Refresh();

            dt = new System.Data.DataTable();
            conn.Open();
            cmd     = new OleDbCommand("SELECT * FROM TheEvents ORDER BY TDate,Time", conn);
            adapter = new OleDbDataAdapter(cmd);
            adapter.Fill(dt);
            conn.Close();

            EventGrid.ItemsSource = dt.DefaultView;
            EventGrid.Items.Refresh();

            Persons PersonCard;

            System.Data.DataTable dt2 = new System.Data.DataTable();
            conn.Open();
            cmd    = new OleDbCommand("SELECT * FROM ComboNames", conn);
            reader = cmd.ExecuteReader();
            int c = 1;

            while (reader.Read())
            {
                bool Isleader = false;
                PersonCard           = new Persons();
                PersonCard.Name.Text = reader["PName"].ToString();
                PersonCard.Des.Text  = reader["PNote"].ToString();
                if (reader["info"].ToString() == "leader")
                {
                    PersonCard.Leader.Visibility = Visibility.Visible;
                    PersonCard.POK.Visibility    = Visibility.Visible;
                    Isleader = true;
                }
                if (reader["info"].ToString() == "POK")
                {
                    PersonCard.POK.Visibility = Visibility.Visible;
                }

                if (reader["info"].ToString().Trim() != "")
                {
                    switch (c)
                    {
                    case 1:
                        Card1.Name.Text      = reader["PName"].ToString();
                        Card1.Des.Text       = reader["PNote"].ToString();
                        Card1.POK.Visibility = Visibility.Visible;
                        Card1.JTime          = Convert.ToInt32(reader["JTime"]);
                        Card1.RTime          = Convert.ToInt32(reader["RTime"]);
                        if (Isleader)
                        {
                            Card1.Leader.Visibility = Visibility.Visible;
                        }
                        break;

                    case 2:
                        Card2.Name.Text      = reader["PName"].ToString();
                        Card2.Des.Text       = reader["PNote"].ToString();
                        Card2.POK.Visibility = Visibility.Visible;
                        Card2.JTime          = Convert.ToInt32(reader["JTime"]);
                        Card2.RTime          = Convert.ToInt32(reader["RTime"]);
                        if (Isleader)
                        {
                            Card2.Leader.Visibility = Visibility.Visible;
                        }
                        break;

                    case 3:
                        Card3.Name.Text      = reader["PName"].ToString();
                        Card3.Des.Text       = reader["PNote"].ToString();
                        Card3.POK.Visibility = Visibility.Visible;
                        Card3.JTime          = Convert.ToInt32(reader["JTime"]);
                        Card3.RTime          = Convert.ToInt32(reader["RTime"]);
                        if (Isleader)
                        {
                            Card3.Leader.Visibility = Visibility.Visible;
                        }
                        break;

                    case 4:
                        Card4.Name.Text      = reader["PName"].ToString();
                        Card4.Des.Text       = reader["PNote"].ToString();
                        Card4.POK.Visibility = Visibility.Visible;
                        Card4.JTime          = Convert.ToInt32(reader["JTime"]);
                        Card4.RTime          = Convert.ToInt32(reader["RTime"]);
                        if (Isleader)
                        {
                            Card4.Leader.Visibility = Visibility.Visible;
                        }
                        break;

                    case 5:
                        Card5.Name.Text      = reader["PName"].ToString();
                        Card5.Des.Text       = reader["PNote"].ToString();
                        Card5.POK.Visibility = Visibility.Visible;
                        Card5.JTime          = Convert.ToInt32(reader["JTime"]);
                        Card5.RTime          = Convert.ToInt32(reader["RTime"]);
                        if (Isleader)
                        {
                            Card5.Leader.Visibility = Visibility.Visible;
                        }
                        break;

                    case 6:
                        Card6.Name.Text      = reader["PName"].ToString();
                        Card6.Des.Text       = reader["PNote"].ToString();
                        Card6.POK.Visibility = Visibility.Visible;
                        Card6.JTime          = Convert.ToInt32(reader["JTime"]);
                        Card6.RTime          = Convert.ToInt32(reader["RTime"]);
                        if (Isleader)
                        {
                            Card6.Leader.Visibility = Visibility.Visible;
                        }
                        break;

                    case 7:
                        Card7.Name.Text      = reader["PName"].ToString();
                        Card7.Des.Text       = reader["PNote"].ToString();
                        Card7.POK.Visibility = Visibility.Visible;
                        if (Isleader)
                        {
                            Card7.Leader.Visibility = Visibility.Visible;
                        }
                        break;

                    case 8:
                        Card8.Name.Text      = reader["PName"].ToString();
                        Card8.Des.Text       = reader["PNote"].ToString();
                        Card8.POK.Visibility = Visibility.Visible;
                        Card8.JTime          = Convert.ToInt32(reader["JTime"]);
                        Card8.RTime          = Convert.ToInt32(reader["RTime"]);
                        if (Isleader)
                        {
                            Card8.Leader.Visibility = Visibility.Visible;
                        }
                        break;

                    case 9:
                        Card9.Name.Text      = reader["PName"].ToString();
                        Card9.Des.Text       = reader["PNote"].ToString();
                        Card9.POK.Visibility = Visibility.Visible;
                        Card9.JTime          = Convert.ToInt32(reader["JTime"]);
                        Card9.RTime          = Convert.ToInt32(reader["RTime"]);
                        if (Isleader)
                        {
                            Card9.Leader.Visibility = Visibility.Visible;
                        }
                        break;

                    case 10:
                        Card10.Name.Text      = reader["PName"].ToString();
                        Card10.Des.Text       = reader["PNote"].ToString();
                        Card10.POK.Visibility = Visibility.Visible;
                        Card10.JTime          = Convert.ToInt32(reader["JTime"]);
                        Card10.RTime          = Convert.ToInt32(reader["RTime"]);
                        if (Isleader)
                        {
                            Card10.Leader.Visibility = Visibility.Visible;
                        }
                        break;

                    case 11:
                        Card11.Name.Text      = reader["PName"].ToString();
                        Card11.Des.Text       = reader["PNote"].ToString();
                        Card11.POK.Visibility = Visibility.Visible;
                        Card11.JTime          = Convert.ToInt32(reader["JTime"]);
                        Card11.RTime          = Convert.ToInt32(reader["RTime"]);
                        if (Isleader)
                        {
                            Card1.Leader.Visibility = Visibility.Visible;
                        }
                        break;

                    case 12:
                        Card12.Name.Text      = reader["PName"].ToString();
                        Card12.Des.Text       = reader["PNote"].ToString();
                        Card12.POK.Visibility = Visibility.Visible;
                        Card12.JTime          = Convert.ToInt32(reader["JTime"]);
                        Card12.RTime          = Convert.ToInt32(reader["RTime"]);
                        if (Isleader)
                        {
                            Card12.Leader.Visibility = Visibility.Visible;
                        }
                        break;

                    case 13:
                        Card13.Name.Text      = reader["PName"].ToString();
                        Card13.Des.Text       = reader["PNote"].ToString();
                        Card13.POK.Visibility = Visibility.Visible;
                        Card13.JTime          = Convert.ToInt32(reader["JTime"]);
                        Card13.RTime          = Convert.ToInt32(reader["RTime"]);
                        if (Isleader)
                        {
                            Card13.Leader.Visibility = Visibility.Visible;
                        }
                        break;
                    }
                    c++;
                }

                WPanel.Children.Add(PersonCard);
            }
            reader.Close();
            adapter2 = new OleDbDataAdapter(cmd);
            adapter2.Fill(dt2);
            conn.Close();

            combo.ItemsSource       = dt2.DefaultView;
            combo.DisplayMemberPath = "PName";
        }
示例#57
0
        public string ToJson(System.Data.DataTable dt)
        {
            string value = JsonConvert.SerializeObject(dt, Formatting.Indented);

            return(value);
        }
        //Exportar Reporte de Personas con estado de cuenta
        public void ExportExcel()
        {
            if (sesion == null)
            {
                sesion = SessionDB.start(Request, Response, false, db);
            }

            try
            {
                System.Data.DataTable tbl = new System.Data.DataTable();
                tbl.Columns.Add("IDSUI", typeof(string));
                tbl.Columns.Add("Nombres", typeof(string));
                tbl.Columns.Add("Apellidos", typeof(string));
                tbl.Columns.Add("Sexo", typeof(string));
                tbl.Columns.Add("Telefono", typeof(string));
                tbl.Columns.Add("Correo", typeof(string));
                tbl.Columns.Add("Tipo de Pago", typeof(string));
                tbl.Columns.Add("Tipo Factura", typeof(string));
                tbl.Columns.Add("Periodo", typeof(string));
                tbl.Columns.Add("Ciclo Escolar", typeof(string));
                tbl.Columns.Add("Nivel", typeof(string));

                ResultSet res = db.getTable("SELECT * FROM QPersonasenEstadodeCuenta01");

                while (res.Next())
                {
                    // Here we add five DataRows.
                    tbl.Rows.Add(res.Get("IDSUI"), res.Get("NOMBRES"), res.Get("APELLIDOS"), res.Get("SEXO"), res.Get("TELEFONO"), res.Get("CORREO"), res.Get("TIPODEPAGO"), res.Get("TIPOFACTURA"), res.Get("PERIODO"), res.Get("CVE_CICLO"), res.Get("CVE_NIVEL"));
                }

                using (ExcelPackage pck = new ExcelPackage())
                {
                    //Create the worksheet
                    ExcelWorksheet ws = pck.Workbook.Worksheets.Add("Reporte de Personas con Estado de Cuenta");

                    //Load the datatable into the sheet, starting from cell A1. Print the column names on row 1
                    ws.Cells["A1"].LoadFromDataTable(tbl, true);
                    ws.Cells["A1:K1"].AutoFitColumns();
                    //ws.Column(1).Width = 20;
                    //ws.Column(2).Width = 80;

                    //Format the header for column 1-3
                    using (ExcelRange rng = ws.Cells["A1:K1"])
                    {
                        rng.Style.Font.Bold        = true;
                        rng.Style.Fill.PatternType = ExcelFillStyle.Solid;                      //Set Pattern for the background to Solid
                        rng.Style.Fill.BackgroundColor.SetColor(Color.FromArgb(79, 129, 189));  //Set color to dark blue
                        rng.Style.Font.Color.SetColor(Color.White);
                    }

                    //Example how to Format Column 1 as numeric
                    using (ExcelRange col = ws.Cells[2, 1, 2 + tbl.Rows.Count, 1])
                    {
                        col.Style.Numberformat.Format = "#,##0.00";
                        col.Style.HorizontalAlignment = ExcelHorizontalAlignment.Right;
                    }

                    //Write it back to the client
                    Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                    Response.AddHeader("content-disposition", "attachment;  filename=ReportePersonasconEstadoDeCuenta.xlsx");
                    Response.BinaryWrite(pck.GetAsByteArray());
                }

                Log.write(this, "Start", LOG.CONSULTA, "Exporta Excel Reporte de Personas con Estado de Cuenta", sesion);
            }
            catch (Exception e)
            {
                ViewBag.Notification = Notification.Error(e.Message);
                Log.write(this, "Start", LOG.ERROR, "Exporta Excel Reporte de Personas con Estado de Cuenta" + e.Message, sesion);
            }
        }
示例#59
0
        /// <summary>
        /// BulkCopyInsert  批量插入数据库
        /// </summary>
        /// <param name="logAppendToForms"></param>
        /// <param name="jobInfo"></param>
        /// <param name="dt"></param>
        /// <param name="tableName"></param>
        /// <returns></returns>
        public int BulkCopyInsert(Log4netUtil.LogAppendToForms logAppendToForms, Model.JobEntity jobInfo, System.Data.DataTable dt, string tableName)
        {
            string logMessage     = string.Empty;
            string strSql         = Util.ConvertHelper.DataTableToStrInsert(dt, tableName) + "\r";
            string targetDatabase = jobInfo.TargetDatabase;

            IDAL.IDBHelper _idbHelper = DALFactory.DBHelperFactory.CreateInstance(targetDatabase);//创建接口/创建接口
            System.Data.Common.DbParameter[] cmdParams = null;
            string jsonSql = Util.DbSqlLog.SqlToJson("9999", strSql, cmdParams);

            logMessage = string.Format("【{0}_{1}】 JsonSql:{2} ", jobInfo.JobCode, jobInfo.JobName, jsonSql);
            Log4netUtil.Log4NetHelper.LogMessage(logAppendToForms, jobInfo.IsDebug, logMessage, @"Database");
            try
            {
                if (_idbHelper.ExecuteNonQuery(System.Data.CommandType.Text, strSql, targetDatabase, cmdParams) > 0)
                {
                    logMessage = string.Format("【{0}_{1}】  执行BulkCopyInsert成功!", jobInfo.JobCode, jobInfo.JobName);
                    Newtonsoft.Json.Linq.JObject resultJObject = new Newtonsoft.Json.Linq.JObject();
                    resultJObject.Add("code", new Newtonsoft.Json.Linq.JValue("0000"));
                    resultJObject.Add("msg", new Newtonsoft.Json.Linq.JValue(logMessage));
                    resultJObject.Add("sql", new Newtonsoft.Json.Linq.JObject(Newtonsoft.Json.Linq.JObject.Parse(jsonSql)));
                    logMessage = string.Format("【{0}_{1}】 {2}", jobInfo.JobCode, jobInfo.JobName, Util.NewtonsoftCommon.SerializeObjToJson(resultJObject));
                    Log4netUtil.Log4NetHelper.LogMessage(logAppendToForms, jobInfo.IsDebug, logMessage, @"Database");
                    return(1);
                }
                else
                {
                    logMessage = string.Format("【{0}_{1}】  执行BulkCopyInsert失败!", jobInfo.JobCode, jobInfo.JobName);
                    Newtonsoft.Json.Linq.JObject resultJObject = new Newtonsoft.Json.Linq.JObject();
                    resultJObject.Add("code", new Newtonsoft.Json.Linq.JValue("9999"));
                    resultJObject.Add("msg", new Newtonsoft.Json.Linq.JValue(logMessage));
                    resultJObject.Add("sql", new Newtonsoft.Json.Linq.JObject(Newtonsoft.Json.Linq.JObject.Parse(jsonSql)));
                    logMessage = string.Format("【{0}_{1}】 {2}", jobInfo.JobCode, jobInfo.JobName, Util.NewtonsoftCommon.SerializeObjToJson(resultJObject));
                    Log4netUtil.Log4NetHelper.LogError(logAppendToForms, jobInfo.IsDebug, logMessage, @"Database");
                    return(-1);
                }
            }
            catch (Exception ex)
            {
                //违反了 PRIMARY KEY 约束

                logMessage = string.Format("【{0}_{1}】  执行BulkCopyInsert失败! 失败原因:{2}", jobInfo.JobCode, jobInfo.JobName, ex.Message);
                Newtonsoft.Json.Linq.JObject resultJObject = new Newtonsoft.Json.Linq.JObject();
                resultJObject.Add("code", new Newtonsoft.Json.Linq.JValue("9999"));
                resultJObject.Add("msg", new Newtonsoft.Json.Linq.JValue(logMessage));
                resultJObject.Add("sql", new Newtonsoft.Json.Linq.JObject(Newtonsoft.Json.Linq.JObject.Parse(jsonSql)));
                logMessage = string.Format("【{0}_{1}】 {2}", jobInfo.JobCode, jobInfo.JobName, Util.NewtonsoftCommon.SerializeObjToJson(resultJObject));
                Log4netUtil.Log4NetHelper.LogError(logAppendToForms, jobInfo.IsDebug, logMessage, @"Database");
                if (ex.Message.Contains("违反了 PRIMARY KEY 约束"))
                {
                    return(2);
                }
                else
                {
                    return(-1);
                }
            }
        }
示例#60
0
 public string ToGridJson(System.Data.DataTable dt)
 {
     return(ToGridJson(dt, -1, null));
 }