コード例 #1
0
 public ActionResult SaveContactInfo(ContactModel data)
 {
     try
     {
         var user     = UserManager.FindById(User.Identity.GetUserId());
         var getQuery = "select ContactId from Contact where ContactId='" + User.Identity.GetUserId() + "'";
         var contact  = ClassDB.CheckRecord(getQuery);
         if (contact == null || contact == "")
         {
             var query = "insert into Contact (ContactId,FirstName,LastName,JobTitle,Department,MobilePhone,EMailAddress1) values('" + User.Identity.GetUserId() + "','" +
                         data.FirstName + "','" + data.LastName + "','" +
                         data.JobTitle + "','" + data.Department + "','" +
                         data.MobilePhone + "','" + data.EMailAddress1 + "') SELECT SCOPE_IDENTITY()";
             var result = ClassDB.Insert(query);
         }
         else
         {
             var query  = @"update Contact set FirstName = '" + data.FirstName + @"',
                             LastName = '" + data.LastName + @"',
                             JobTitle = '" + data.JobTitle + @"',
                             Department = '" + data.Department + @"',
                             MobilePhone = '" + data.MobilePhone + @"',
                             EMailAddress1 = '" + data.EMailAddress1 + "' where ContactId='" + User.Identity.GetUserId() + "'";
             var result = ClassDB.update(query);
         }
         user.UserProfileCompleted = true;
         UserManager.Update(user);
         return(RedirectToAction("AccountInfo", "Account"));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
コード例 #2
0
        //Для редактирования
        public FormAddCar(ClassDB db, string numSTSCar, string brand, string model,
                          string yearCreated, string dateTO)
        {
            InitializeComponent();

            edit = true;

            this.db = db;

            btAdd.Text = "Редактировать";

            tbNumSTS.Enabled = false;

            if (dateTO == "")
            {
                checkBoxIsDateEmpty.Checked = true;
            }
            else
            {
                dtpDateTO.Value = Convert.ToDateTime(dateTO);
            }

            for (int i = DateTime.Now.Year; i >= 1970; i--)
            {
                cbYear.Items.Add(i);
            }

            tbNumSTS.Text = numSTSCar;
            tbBrand.Text  = brand;
            tbModel.Text  = model;
            cbYear.Text   = yearCreated;
        }
コード例 #3
0
 public FormAddRepairForCurrentClient(ClassDB db, string categoryRepairs)
 {
     InitializeComponent();
     this.db = db;
     db.SearchCategoriesRepairs(cbCategoryRepairs);
     cbCategoryRepairs.Text = categoryRepairs;
 }
コード例 #4
0
ファイル: FormAddRepairs.cs プロジェクト: VitenbergVG/STO
 public FormAddRepairs()
 {
     InitializeComponent();
     db = new ClassDB();
     db.SearchPosition(cbPosition);
     db.SearchCategories(cbCategory);
 }
コード例 #5
0
 protected void btnEditClass_Click(object sender, EventArgs e)
 {
     try
     {
         tblClass clas = new tblClass();
         clas.Id     = selectRole.SelectedValue.ToString();
         clas.Name   = txtClassName.Value;
         clas.Status = cbkActive.Checked ? true : false;
         if (fleUpload.HasFile)
         {
             string img = SaveAvata(fleUpload.PostedFile) ? "~/Content/Image_Class/" + fleUpload.PostedFile.FileName : "";
             if (!string.IsNullOrEmpty(img))
             {
                 clas.Avata = img;
             }
         }
         bool check = new ClassDB().UpdateClass(clas);
         if (check)
         {
             this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Chỉnh Sửa thông tin thành công')", true);
         }
         else
         {
             this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Chỉnh Sửa thông tin thất bại')", true);
         }
     }
     catch (Exception)
     {
         this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Chỉnh Sửa thông tin thất bại')", true);
     }
 }
コード例 #6
0
 public override void setClickButton()
 {
     ClassDB.readAllDB();
     //Awake111();
     //Debug_Log.Call_WriteLog("child setClickButton..=");
     // return System.Math.PI * Radius * Radius;
 }
コード例 #7
0
 protected void btnCreateClass_Click(object sender, EventArgs e)
 {
     try
     {
         tblClass clas = new tblClass();
         clas.Name   = txtClassName.Value;
         clas.Id     = new Locdau().LocDauChuoi(txtClassName.Value).ToUpper();
         clas.Status = cbkActive.Checked ? true : false;
         if (fleUpload.HasFile)
         {
             string img = SaveAvata(fleUpload.PostedFile) ? "/Content/Image_Class/" + fleUpload.PostedFile.FileName : "";
             if (!img.Equals(""))
             {
                 clas.Avata = img;
             }
         }
         bool check = new ClassDB().InsertDB(clas);
         if (check)
         {
             this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Thêm mới thông tin thành công')", true);
         }
         else
         {
             this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Thêm mới thông tin thất bại')", true);
         }
     }
     catch (Exception)
     {
         this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Chỉnh Sửa thông tin thất bại')", true);
     }
 }
コード例 #8
0
 public ActionResult SaveAccountInfo(AccountModel data)
 {
     try
     {
         var getQuery         = "select ParentCustomerId from Contact where ContactId='" + User.Identity.GetUserId() + "'";
         var ParentCustomerId = ClassDB.CheckRecord(getQuery);
         if (ParentCustomerId == null)
         {
             var query = "insert into Account (AccountID,EMailAddress1,Name,Telephone1,StateCode,OwnerId,OwnerIdType,LivestockType) OUTPUT INSERTED.AccountId values(NEWID()" + ",'" +
                         data.EMailAddress1 + "','" + data.Name + "','" + data.Telephone1 + "','0','" + User.Identity.GetUserId() + "','1','1') SELECT SCOPE_IDENTITY()";
             var result        = ClassDB.Insert(query);
             var updateContact = @"update Contact set ParentCustomerId = '" + result + "' where ContactId='" + User.Identity.GetUserId() + "'";
             var res           = ClassDB.update(updateContact);
         }
         else
         {
             var query = @"update Account set EMailAddress1 = '" + data.EMailAddress1 + @"',
                             Name = '" + data.Name + @"',
                             Telephone1 = '" + data.Telephone1
                         + "' where AccountId='" + ParentCustomerId + "'";
             var result = ClassDB.update(query);
         }
         return(RedirectToAction("Index", "Home"));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
コード例 #9
0
        public void LoadData()
        {
            List <tblClass> list = null;

            list = new ClassDB().GetAllClass();
            repGetAllClass.DataSource = list;
            repGetAllClass.DataBind();
        }
コード例 #10
0
        public FormAddWorkHoursRepair(ClassDB db)
        {
            InitializeComponent();

            this.db = db;

            db.SearchCategoriesRepairs(cbCategoryRepair);
            cbStatusRepair.SelectedIndex = 0;
        }
コード例 #11
0
        public FormAddRepair(ClassDB db)
        {
            InitializeComponent();

            this.db = db;
            db.SearchPosition(cbPosition);
            db.SearchCategoriesRepairs(cbCategory);
            tbIDRepair.Text = (db.LastRepair() + 1).ToString();
        }
コード例 #12
0
 public FormAddAction(ClassDB db, string idAction, string name, string text)
 {
     InitializeComponent();
     this.db           = db;
     edit              = true;
     this.idAction     = idAction;
     tbNameAction.Text = name;
     tbTextAction.Text = text;
 }
コード例 #13
0
ファイル: Main.cs プロジェクト: tudela/anubisbotsinais
    static void Main(string[] args)
    {
        Bot = new TelegramBotClient("***********************");
        var me = Bot.GetMeAsync().Result;

        Console.Title = me.Username;

        Bot.OnMessage            += BotOnMessageReceived;
        Bot.OnMessageEdited      += BotOnMessageReceived;
        Bot.OnCallbackQuery      += BotOnCallbackQueryReceived;
        Bot.OnInlineQuery        += BotOnInlineQueryReceived;
        Bot.OnInlineResultChosen += BotOnChosenInlineResultReceived;
        Bot.OnReceiveError       += BotOnReceiveError;

        Bot.StartReceiving(Array.Empty <UpdateType>());
        Console.WriteLine($"Start listening for @{me.Username}");

        Bot.SendTextMessageAsync("@anubis_sinais", "Olá, sou o AnubisTradeBot estou procurando oportunidades, assim que achar lhe aviso...");
        while (true)
        {
            //
            try
            {
                System.Data.DataTable dt = ClassDB.get("select * from yet8263mduem where few42fd = 0 and 432d23432 = 'BINANCE' order by rwe421 desc");
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        String msg = " == SINAL DE COMPRA == " + Environment.NewLine + Environment.NewLine;
                        msg += "Data: " + DateTime.Parse(dt.Rows[i]["dta_data_buy"].ToString()).ToString("dd/MM/yyyy HH:mm:ss") + Environment.NewLine;
                        msg += "Exchange: Binance" + Environment.NewLine;
                        msg += "Moeda: " + dt.Rows[i]["nom_coin"].ToString() + Environment.NewLine + Environment.NewLine;
                        msg += "Comprar: " + Math.Round(decimal.Parse(dt.Rows[i]["ee21e3"].ToString().Replace(".", ",")), 8) + Environment.NewLine;
                        msg += "Target: " + Math.Round(decimal.Parse(dt.Rows[i]["321rew"].ToString().Replace(".", ",")), 8) + Environment.NewLine;
                        msg += "Stop: " + Math.Round(decimal.Parse(dt.Rows[i]["dqwdwq"].ToString().Replace(".", ",")), 8) + Environment.NewLine + Environment.NewLine;
                        msg += "Tempo gráfico: " + dt.Rows[i]["dqwdwq"].ToString() + Environment.NewLine + Environment.NewLine;
                        msg += "Acesse: https://anubis.website" + Environment.NewLine + Environment.NewLine;
                        msg += " == FINAL - SINAL DE COMPRA == " + Environment.NewLine;


                        Console.WriteLine(msg);
                        Bot.SendTextMessageAsync("@anubis_sinais", msg);
                        ClassDB.execS("update anubis_orders set num_telegram = 1 where cod_order = " + dt.Rows[i]["cod_order"].ToString());
                    }
                }
            }
            catch { }

            Console.WriteLine(DateTime.Now.ToString());
            Console.WriteLine("Sleep 60s");
            System.Threading.Thread.Sleep(60000);
        }


        Console.ReadLine();
        Bot.StopReceiving();
    }
コード例 #14
0
        public void LoadData()
        {
            List <tblClass> list = null;

            list = new ClassDB().GetAllClass();

            selectRole.DataSource     = list;
            selectRole.DataTextField  = "Name";
            selectRole.DataValueField = "Id";
            selectRole.DataBind();
        }
コード例 #15
0
ファイル: FormActions.cs プロジェクト: VitenbergVG/STO
        public FormActions()
        {
            InitializeComponent();
            dataGridView1.ColumnCount = 3;
            dataGridView1.Columns[0].HeaderCell.Value = "ID";
            dataGridView1.Columns[1].HeaderCell.Value = "Название";
            dataGridView1.Columns[2].HeaderCell.Value = "Текст";

            db = new ClassDB();
            db.LoadTables("actions", dataGridView1);
        }
コード例 #16
0
        //Для добавления
        public FormAddCar(ClassDB db)
        {
            InitializeComponent();

            this.db = db;

            checkBoxIsDateEmpty.Checked = true;

            for (int i = DateTime.Now.Year; i >= 1970; i--)
            {
                cbYear.Items.Add(i);
            }
        }
コード例 #17
0
 public void LoadData()
 {
     try
     {
         List <tblClass> list = null;
         list = new ClassDB().GetClassByStatus(true);
         repGetAllClass.DataSource = list;
         repGetAllClass.DataBind();
     }
     catch (Exception)
     {
     }
 }
コード例 #18
0
ファイル: FormRepairs.cs プロジェクト: VitenbergVG/STO
 public FormRepairs()
 {
     InitializeComponent();
     db = new ClassDB();
     dataGridView1.ColumnCount = 5;
     dataGridView1.Columns[0].HeaderCell.Value = "ID работы";
     dataGridView1.Columns[1].HeaderCell.Value = "Наименование";
     dataGridView1.Columns[2].HeaderCell.Value = "Категория";
     dataGridView1.Columns[3].HeaderCell.Value = "Цена";
     dataGridView1.Columns[4].HeaderCell.Value = "Должность";
     dataGridView1.AutoSizeColumnsMode         = DataGridViewAutoSizeColumnsMode.AllCells;
     db.LoadTables("repairs", dataGridView1);
 }
コード例 #19
0
        public FormPerformedRepairs(ClassDB db)
        {
            InitializeComponent();
            this.db = db;

            dgvRepairs.ColumnCount = 6;
            dgvRepairs.Columns[0].HeaderCell.Value = "Id клиента";
            dgvRepairs.Columns[1].HeaderCell.Value = "CТС машины";
            dgvRepairs.Columns[2].HeaderCell.Value = "Id ремонтной работы";
            dgvRepairs.Columns[3].HeaderCell.Value = "Id сотрудника";
            dgvRepairs.Columns[4].HeaderCell.Value = "Дата";
            dgvRepairs.Columns[5].HeaderCell.Value = "Время окончания работы";
            db.GetPerformedRepairs(dgvRepairs);
        }
コード例 #20
0
 protected void selectRole_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         string   id   = selectRole.SelectedValue.ToString();
         tblClass clas = new ClassDB().GetClassById(id);
         txtClassName.Value = clas.Name;
         avataEdit.Src      = string.IsNullOrEmpty(clas.Avata) ? "/Content/Image_Class/lophoc4.jpg" : avataEdit.Src = clas.Avata;
         cbkActive.Checked  = clas.Status == true ? true : false;
     }
     catch (Exception ex)
     {
         this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Có vấn đề từ phía sever :')" + ex, true);
     }
 }
コード例 #21
0
        public FormAddEmployee(ClassDB db, string idEmployee, string surname, string name, string patronimyc,
                               string phoneNumber, string position, string rating)
        {
            InitializeComponent();
            this.db = db;
            edit    = true;
            db.SearchPosition(cbPosition);
            tbRating.Enabled = true;

            this.idEmployee   = idEmployee;
            tbSurname.Text    = surname;
            tbName.Text       = name;
            tbPatronimyc.Text = patronimyc;
            tbPhone.Text      = phoneNumber;
            cbPosition.Text   = position;
        }
コード例 #22
0
ファイル: Devis.xaml.cs プロジェクト: SokolSib/FRANCE
        public void send(Guid infoClientsCustomerId, List <XElement> prod)
        {
            int maxId = ((int)new ClassDB(null).queryResonse("SELECT MAX(Id) FROM DevisId")[0][0]) + 1;

            if (maxId > 0)
            {
                ClassDB db = new ClassDB(null);

                string cmd1 = "INSERT INTO DevisId VALUES ( CAST('{Date}' AS DATETIME), {Close},'{infoClientsCustomerId}', {Total}) ";

                decimal Total = prod.Sum(l => decimal.Parse(l.Element("TOTAL").Value.Replace('.', ',')));



                cmd1 = cmd1
                       .Replace("{Id}", maxId.ToString())
                       .Replace("{Date}", DateTime.Now.ToString())
                       .Replace("{Close}", "0")
                       .Replace("{infoClientsCustomerId}", infoClientsCustomerId.ToString())
                       .Replace("{Total}", Total.ToString().Replace(",", "."));

                db.queryNonResonse(cmd1);

                maxId = ((int)new ClassDB(null).queryResonse("SELECT MAX(Id) FROM DevisId")[0][0]);

                string cmd2 = "INSERT INTO DevisWeb VALUES ( '{CustomerId}', {IdDevis}, {PrixHT}, {MonPrixHT}, {QTY}, {TotalHT}, {PayementType},{Operator},'{ProductsCustumerId}', '{InfoClients_custumerId}') ";

                foreach (XElement x in prod)
                {
                    string cmd_ = cmd2
                                  .Replace("{CustomerId}", Guid.NewGuid().ToString())
                                  .Replace("{IdDevis}", maxId.ToString())
                                  .Replace("{PrixHT}", x.Element("price").Value.Replace(',', '.'))
                                  .Replace("{MonPrixHT}", (decimal.Parse(x.Element("ContenanceBox").Value.Replace('.', ',')) == 0.0m ? 1 : decimal.Parse(x.Element("ContenanceBox").Value.Replace('.', ','))).ToString().Replace(",", "."))
                                  .Replace("{QTY}", x.Element("QTY").Value.Replace(',', '.'))
                                  .Replace("{TotalHT}", x.Element("TOTAL").Value.Replace(",", "."))
                                  .Replace("{PayementType}", "-2")
                                  .Replace("{Operator}", "1")

                                  .Replace("{ProductsCustumerId}", x.Element("CustumerId").Value)
                                  .Replace("{InfoClients_custumerId}", infoClientsCustomerId.ToString());
                    db.queryNonResonse(cmd_);

                    Class.ClassProducts.clrElm(new XElement[] { x });
                }
            }
        }
コード例 #23
0
        public FormAddRepair(ClassDB db, string idRepair, string name, string category,
                             string cost, string position)
        {
            InitializeComponent();

            this.db = db;
            edit    = true;

            db.SearchPosition(cbPosition);
            db.SearchCategoriesRepairs(cbCategory);

            tbIDRepair.Enabled = false;

            tbIDRepair.Text = idRepair;
            tbName.Text     = name;
            cbCategory.Text = category;
            tbCost.Text     = cost;
            cbPosition.Text = position;
        }
コード例 #24
0
        public FormAddWorkHours(List <DateTime> dates, List <string> surnameEmployees, List <int> idEmployees)
        {
            InitializeComponent();
            db = new ClassDB();

            for (int i = 0; i < dates.Count; i++)
            {
                cbDateOfWeek.Items.Add(dates[i].ToShortDateString());
                cbDateStart.Items.Add(dates[i].ToShortDateString());
            }

            for (int i = 0; i < surnameEmployees.Count; i++)
            {
                cbSurnameEmployee.Items.Add(surnameEmployees[i]);
                cbSurnameEmployeeRegularity.Items.Add(surnameEmployees[i]);
            }

            globalidEmployees = idEmployees;
            globalDates       = dates;
        }
コード例 #25
0
        public ClassDB ConvertToDB()
        {
            ClassDB returnValue = new ClassDB
            {
                ClassID               = this.ClassID,
                UnitID                = this.UnitID,
                Type                  = this.Type,
                DayOfWeek             = this.DayOfWeek,
                StartTime             = this.StartTime,
                EndTime               = this.EndTime,
                DisplayMode           = this.DisplayMode,
                Mode                  = this.Mode,
                DisplayTime           = this.DisplayTime,
                Room                  = this.Room,
                Registerd             = this.Registerd,
                Planned               = this.Planned,
                Colour                = this.Colour,
                ClashMessage          = this.ClashMessage,
                ClashMessageIsVisible = this.ClashMessageIsVisible
            };

            return(returnValue);
        }
コード例 #26
0
 public FormAddWorkHoursRepairs()
 {
     InitializeComponent();
     db = new ClassDB();
     db.SearchCategories(cbCategoryRepair);
 }
コード例 #27
0
    public static void captureData()
    {
        lock (MainClass.data)
        {
            string dataBaseFile = MainClass.location + "bd.xml";
            try
            {
                System.Data.DataSet ds = null;
                bool create            = false;
                if (!System.IO.File.Exists(dataBaseFile))
                {
                    System.Data.DataTable dt = new System.Data.DataTable("Balances");
                    dt.Columns.Add("Date");
                    dt.Columns.Add("Coin");
                    dt.Columns.Add("Amount");

                    dt.Rows.Add("", "", "");

                    System.Data.DataTable dtParameters = new System.Data.DataTable("Parameters");
                    dtParameters.Columns.Add("Parameter");
                    dtParameters.Columns.Add("Value");
                    dtParameters.Rows.Add("", "");


                    ds             = new System.Data.DataSet();
                    ds.DataSetName = "Database";
                    ds.Tables.Add(dt);
                    ds.Tables.Add(dtParameters);
                    ds.WriteXml(dataBaseFile);
                    create = true;
                }

                ds = new System.Data.DataSet();
                ds.ReadXml(dataBaseFile);

                BitMEX.BitMEXApi bitMEXApi  = new BitMEX.BitMEXApi(MainClass.bitmexKey, MainClass.bitmexSecret, MainClass.bitmexDomain);
                string           json       = bitMEXApi.GetWallet();
                JContainer       jCointaner = (JContainer)JsonConvert.DeserializeObject(json, (typeof(JContainer)));


                ClassDB.execS(ClassDB.dbquery.Replace("@balance", jCointaner[0]["walletBalance"].ToString().Replace(",", ".")));

                if (create)
                {
                    ds.Tables[0].Rows.Clear();
                }

                ds.Tables[0].Rows.Add(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), MainClass.pair, jCointaner[0]["walletBalance"].ToString());

                ds.Tables[1].Rows.Clear();
                ds.Tables[1].Rows.Add("OpenOrders", bitMEXApi.GetOpenOrders(MainClass.pair).Count);
                ds.Tables[1].Rows.Add("Amount", jCointaner[0]["walletBalance"].ToString());


                System.IO.File.Delete(dataBaseFile);
                ds.WriteXml(dataBaseFile);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
    }
コード例 #28
0
 public FormAddAction(ClassDB db)
 {
     InitializeComponent();
     this.db = db;
 }
コード例 #29
0
 public M_Login()
 {
     classDB = new ClassDB();
 }
コード例 #30
0
 public FormAddEmployee(ClassDB db)
 {
     InitializeComponent();
     this.db = db;
     db.SearchPosition(cbPosition);
 }