示例#1
0
        public List <Cliente> TraeListaClientes()
        {
            listaClientes = new List <Cliente>();

            //objCliente = new Cliente();

            if (TraeCliente() != null)
            {
                listaClientes = ConvertList.DataTableToList <Cliente>(TraeCliente());

                /*
                 * foreach (DataRow fila in objDataTable.Rows)
                 * {
                 *  objCliente = new Cliente();
                 *  objCliente.Documento = fila["Documento"].ToString();
                 *  objCliente.Nombre = fila["Nombre"].ToString();
                 *  objCliente.Apellido = fila["Apellido"].ToString();
                 *  objCliente.Celular = fila["Celular"].ToString();
                 *  objCliente.Correo = fila["Correo"].ToString();
                 *  objCliente.Usuario = fila["Usuario"].ToString();
                 *  objCliente.Contrasena = fila["Contrasena"].ToString();
                 *  listaClientes.Add(objCliente);
                 * }*/
            }
            return(listaClientes);
        }
示例#2
0
 private void Converter()
 {
     if (_file.TaskCompleted() == true)
     {
         ConvertList.Where(w => w.Progress == "Not Completed").ToList().ForEach(s => s.Progress = "Completed");
         ConvertedFiles = ConvertFromBinToCSV.ListOfcsvCompletePath;
     }
 }
示例#3
0
        private static void Task()
        {
            int[,] Arr2 = ToolsConsoleArr2.ReadArr2();
            ToolsArr2   toolsArr2 = new ToolsArr2(Arr2);
            List <Cell> list      = toolsArr2.GetCels();

            ToolsConsoleArr2.OutputStr(ConvertList.ListToStr(list));
        }
示例#4
0
 private void DownloadFile()
 {
     if (files.Name != String.Empty)
     {
         var model = _file.Load();
         var files = new FilesModel();
         files.Name     = model.Name;
         files.Progress = model.Progress;
         ConvertList.Add(files);
     }
 }
示例#5
0
        private void FillConvertList()
        {
            // string out type
            ConvertList.Add(new ValidFunc()
            {
                InType    = dataType.String,
                OutType   = dataType.String,
                Validator = ValidToStr
            }
                            );
            ConvertList.Add(new ValidFunc()
            {
                InType    = dataType.Double,
                OutType   = dataType.String,
                Validator = ValidToStr
            });
            ConvertList.Add(new ValidFunc()
            {
                InType    = dataType.DateTime,
                OutType   = dataType.String,
                Validator = ValidToStr
            });

            // decimal out type
            ConvertList.Add(new ValidFunc()
            {
                InType    = dataType.String,
                OutType   = dataType.Double,
                Validator = ValidToDouble
            });
            ConvertList.Add(new ValidFunc()
            {
                InType    = dataType.Double,
                OutType   = dataType.Double,
                Validator = ValidToDouble
            });

            // dateTime out type
            ConvertList.Add(new ValidFunc()
            {
                InType    = dataType.String,
                OutType   = dataType.DateTime,
                Validator = ValidToDT
            });
            ConvertList.Add(new ValidFunc()
            {
                InType    = dataType.DateTime,
                OutType   = dataType.DateTime,
                Validator = ValidToDT
            });
        }
示例#6
0
 private void CalcBtn_Click(object sender, EventArgs e)
 {
     try
     {
         List <int> list      = ConvertList.StrToList(ListInput.Text);
         ToolsList  toolsList = new ToolsList(list);
         List <int> listNew   = (List <int>)toolsList.Process((int)InputN.Value);
         Output.Text = ConvertList.ListToStr(listNew, ", ");
     }
     catch (Exception)
     {
         MessageBox.Show("ошибка ввода", "ошибка");
     }
 }
示例#7
0
 private void CalcBtn_Click(object sender, EventArgs e)
 {
     try
     {
         List <int> list      = ConvertList.StrToList(ListInput.Text);
         ToolsList  toolsList = new ToolsList(list);
         List <int> listNew   = toolsList.Process(out bool success);
         Output.Text = ConvertList.ListToStr(listNew) + "\n" + (success ? "успешно" : "не успешно");
     }
     catch (Exception)
     {
         MessageBox.Show("ошибка ввода", "ошибка");
     }
 }
示例#8
0
 private void SearchBtn_Click(object sender, EventArgs e)
 {
     try
     {
         int[,] Arr2 = DataGridViewUtils.GridToArray2 <int>(Input);
         ToolsArr2   toolsArr2 = new ToolsArr2(Arr2);
         List <Cell> list      = toolsArr2.GetCels();
         Output.Text  = ConvertList.ListToStr(list);
         save.Enabled = true;
     }
     catch (Exception)
     {
         MessageBox.Show("ошибка ввода", "ошибка");
     }
 }
 static void Main(string[] args)
 {
     while (true)
     {
         int[,] Arr2 = ToolsConsoleArr2.ReadArr2();
         if (Arr2.GetLength(0) != Arr2.GetLength(1))
         {
             Console.WriteLine("не квадратная матрица");
         }
         else
         {
             ToolsArr2   toolsArr2 = new ToolsArr2(Arr2);
             IList <Row> list      = toolsArr2.GetRowsSum();
             ToolsConsoleArr2.OutputStr(ConvertList.ListToStr(list, "\r\n"));
         }
     }
 }
示例#10
0
 private void Clear()
 {
     ConvertList.Clear();
     ConvertedFiles.Clear();
 }
        public void saveLevelData(LevelData lvData)
        {
            SQLiteConnection cnn = new SQLiteConnection("data source = " + m_dbPath);

            cnn.Open();

            var cmd = cnn.CreateCommand();

            cmd.CommandText = string.Format("SELECT * FROM Level WHERE level={0}", lvData.id);
            var reader = cmd.ExecuteReader();

            string[] keys = "level,type,total,star_score,orders,special_orders,anyfood_orders,max_order,order_interval,first_arrival,waiting_time_decay,secret_customers,mucky_interval,broken_interval,rain_interval,requirement,organic_materials,unlock".Split(',');

            string updateStr = "";

            if (reader.Read())
            {// 已存在,修改数值
                StringBuilder cmdStr = new StringBuilder();
                cmdStr.Append("UPDATE Level SET ");

                var itor = keys.GetEnumerator();
                while (true)
                {
                    bool result = itor.MoveNext();
                    if (!result)
                    {
                        cmdStr.Remove(cmdStr.Length - 1, 1);
                        break;
                    }
                    string key = (string)itor.Current;
                    cmdStr.Append(key).Append("=@").Append(key).Append(",");
                }

                cmdStr.Append(" WHERE level=").Append(lvData.id);

                updateStr = cmdStr.ToString();
                MyDebug.WriteLine("Update cmdStr = " + updateStr);
            }
            else
            {
                StringBuilder cmdStr = new StringBuilder();
                cmdStr.Append("INSERT INTO Level(");

                var itor = keys.GetEnumerator();
                while (true)
                {
                    bool result = itor.MoveNext();
                    if (!result)
                    {
                        cmdStr.Remove(cmdStr.Length - 1, 1);
                        break;
                    }
                    string key = (string)itor.Current;
                    cmdStr.Append(key).Append(",");
                }

                cmdStr.Append(") VALUES(");

                itor = keys.GetEnumerator();
                while (true)
                {
                    bool result = itor.MoveNext();
                    if (!result)
                    {
                        cmdStr.Remove(cmdStr.Length - 1, 1);
                        break;
                    }
                    string key = (string)itor.Current;
                    cmdStr.Append("@").Append(key).Append(",");
                }

                cmdStr.Append(")");

                updateStr = cmdStr.ToString();
                MyDebug.WriteLine("Add cmdStr = " + updateStr);
                //updateStr = "INSERT INTO Level(customer_id, customer_key, Name_CN, food_id, food_key, foodname_cn, wait_time, tips, consider_time) VALUES(@customer_id, @customer_key, @Name_CN, @food_id, @food_key, @foodname_cn, @wait_time, @tips, @consider_time)"
            }
            reader.Close();
            cmd.Dispose();

            cmd             = cnn.CreateCommand();
            cmd.CommandText = updateStr;
            //"level,type,total,star_score,orders,special_orders,anyfood_orders,max_order,order_interval,first_arrival,waiting_time_decay," +
            //"secret_customers,mucky_interval,broken_interval,rain_interval,requirement,organic_materials,required_kitchenware,unlock,rewards"
            cmd.Parameters.Add("level", System.Data.DbType.Int32).Value               = lvData.id;
            cmd.Parameters.Add("type", System.Data.DbType.String).Value               = (lvData.type == LevelType.FIXED_CUSTOMER ? "FIXED_CUSTOMER" : (lvData.type == LevelType.FIXED_TIME ? "FIXED_TIME" : "LOST_CUSTOMER"));
            cmd.Parameters.Add("total", System.Data.DbType.Int32).Value               = lvData.total;
            cmd.Parameters.Add("star_score", System.Data.DbType.String).Value         = ConvertList.List2String <string>(lvData.scoreList, ';');
            cmd.Parameters.Add("orders", System.Data.DbType.String).Value             = exportOrders(lvData.orders);
            cmd.Parameters.Add("special_orders", System.Data.DbType.String).Value     = exportOrders(lvData.specialOrders);
            cmd.Parameters.Add("anyfood_orders", System.Data.DbType.String).Value     = exportOrders(lvData.anyfoodOrders);
            cmd.Parameters.Add("max_order", System.Data.DbType.Int32).Value           = lvData.max_order;
            cmd.Parameters.Add("order_interval", System.Data.DbType.String).Value     = string.Format("{0},{1}", lvData.order_interval.min, lvData.order_interval.max);
            cmd.Parameters.Add("first_arrival", System.Data.DbType.String).Value      = ConvertList.List2String <float>(lvData.first_arrivals, ',');
            cmd.Parameters.Add("waiting_time_decay", System.Data.DbType.String).Value = string.Format("{0},{1}", lvData.waiting_decay.interval, lvData.waiting_decay.rate);
            string secretStr = "";
            var    it        = lvData.secret_customers.GetEnumerator();
            bool   hasNext   = it.MoveNext();

            while (hasNext)
            {
                SecretCustomer secCus = it.Current;
                secretStr += secCus.customer;
                if (secCus.showOrder > 0)
                {
                    secretStr += string.Format("<{0}>", secCus.showOrder);
                }
                hasNext = it.MoveNext();
                if (hasNext)
                {
                    secretStr += ";";
                }
            }
            cmd.Parameters.Add("secret_customers", System.Data.DbType.String).Value = secretStr;
            cmd.Parameters.Add("mucky_interval", System.Data.DbType.String).Value   = string.Format("{0},{1}", lvData.litter_interval.min, lvData.litter_interval.max);
            cmd.Parameters.Add("broken_interval", System.Data.DbType.String).Value  = string.Format("{0},{1}", lvData.broken_interval.min, lvData.broken_interval.max);
            cmd.Parameters.Add("rain_interval", System.Data.DbType.String).Value    = string.Format("{0},{1}", lvData.rain_interval.min, lvData.rain_interval.max);
            string requireStr = "";

            if (lvData.requirements.requiredCustomers.Count > 0)
            {
                foreach (var req in lvData.requirements.requiredCustomers)
                {
                    requireStr += string.Format("{0}*{1};", req.name, req.number);
                }
            }
            else if (lvData.requirements.requiredFoods.Count > 0)
            {
                foreach (var req in lvData.requirements.requiredFoods)
                {
                    requireStr += string.Format("{0}*{1};", req.name, req.number);
                }
            }
            else if (!lvData.requirements.allowBurn)
            {
                requireStr += "no_burn;";
            }
            else if (!lvData.requirements.allowLostCustomer)
            {
                requireStr += "no_lost;";
            }
            else if (lvData.requirements.smileCount > 0)
            {
                requireStr += "smile*" + lvData.requirements.smileCount + ";";
            }
            if (requireStr.Length > 0)
            {
                requireStr = requireStr.Substring(0, requireStr.Length - 1);
            }
            cmd.Parameters.Add("secret_customers", System.Data.DbType.String).Value  = requireStr;
            cmd.Parameters.Add("organic_materials", System.Data.DbType.String).Value = ConvertList.List2String <string>(lvData.organicMaterials, ';');
            cmd.Parameters.Add("unlock", System.Data.DbType.Int32).Value             = ConvertList.List2String <int>(lvData.unlock_items, ';');

            try{
                int updateRlt = cmd.ExecuteNonQuery();
                MyDebug.WriteLine("Update levelData result : ", updateRlt);
            }catch (Exception e)
            {
                MyDebug.WriteLine(e);
            }
        }
示例#12
0
 //  get infomation of patient
 private Patient GetPatientInfomation(long id)
 {
     Access access = new Access();
     ConvertList<Patient> PatientInfo = new ConvertList<Patient>();
     PatientInfo.Table = access.getPatientDetail_SearchById(Convert.ToInt64(id));
     PatientInfo.toList();
     return (Patient)PatientInfo.list[0];
 }