Update() публичный статический Метод

public static Update ( string sql ) : int
sql string
Результат int
Пример #1
0
        private bool Add_Update()
        {
            try
            {
                DB db = new DB("products");

                db.AddColumn("pro_cat_id", Categories_CB.SelectedValue);
                db.AddColumn("pro_name", Product_TB.Text.Trim());
                db.AddColumn("pro_sell", Sell_Price_TB.Text.Trim());


                if(Product_Id == null)
                {
                    if(db.IsNotExist("pro_id", "pro_name", "pro_cat_id"))
                    {
                        return db.Insert();
                    }
                    else
                    {
                        Message.Show("هذا المنتج مسجل من قبل", MessageBoxButton.OK, 5);
                        return false;
                    }
                }
                else
                {                 
                    db.AddCondition("pro_Id", this.Product_Id);
                    return db.Update();
                }

            }
            catch
            {
                return false;
            }
        }
Пример #2
0
        private bool Add_Update()
        {
            try
            {

                DB DataBase = new DB("groups");

                DataBase.AddColumn("grp_name", Type_TB.Text);

                if(Group_Id == null)
                {
                    if(DataBase.IsNotExist("grp_id", "grp_name"))
                    {
                        return Confirm.Check(DataBase.Insert());
                    }
                    else
                    {
                        Message.Show("لقد تم تسجيل هذا النوع من قبل", MessageBoxButton.OK, 5);
                        return false;
                    }


                }
                else
                {
                    DataBase.AddCondition("grp_id", this.Group_Id);
                    return Confirm.Check(DataBase.Update());
                }
            }
            catch
            {
                //MessageBox.Show("kiki_method");
                return false;
            }
        }
Пример #3
0
        private bool Add_Update()
        {
            try
            {

                DB DataBase = new DB("Categories");

                DataBase.AddColumn("cat_name", Category_TB.Text.Trim());

                if(Category_Id == null)
                {
                    if(DataBase.IsNotExist("cat_id", "cat_name"))
                    {
                        return Confirm.Check(DataBase.Insert());
                    }
                    else
                    {
                        Message.Show("لقد تم تسجيل هذه الفئة من قبل", MessageBoxButton.OK, 5);
                        return false;
                    }


                }
                else
                {
                    DataBase.AddCondition("cat_id", this.Category_Id);
                    return Confirm.Check(DataBase.Update());
                }
            }
            catch
            {
                //MessageBox.Show("kiki_method");
                return false;
            }
        }
    protected void change_Click(object sender, EventArgs e)
    {
        DB db = new DB();
        DataSet ds = db.Select("select * from admin where admin_ID='" + Session["username"] + "'", db.DBconn());
        try
        {     string password = ds.Tables[0].Rows[0][2].ToString();
            md5Manger md5 = new md5Manger();
             password = md5.Md5Decrypt(password);
            //解密
       
            string oldpassword = this.oldpassword.Text.Trim();
            string newpassword = this.newpassword.Text.Trim();
            if (password.Equals(oldpassword))
            {
                newpassword = md5.Md5Encrypt(newpassword);//加密
                string updatepassword = "******" + newpassword + "' WHERE admin_ID ='" + Session["username"].ToString() + "'";
                bool result = db.Update(updatepassword, db.DBconn());
                // Response.Write("<script language='javascript'>alert('您的jieguo为:" + result + "')</script>");
                if (result)
                {


                    this.message.Text = "密码更改成功!";

                }

                else
                {
                    this.message.Text = "数据库更新失败!";

                }

            }

            else
            {
                this.message.Text = "对不起,您的密码输入错误,请重新输入";

            }
        
        }
        catch
        {
            Response.Write("<script>alert('数据库获取用户密码错误。');location='Default.aspx'</script>");
        }
       finally
       {
           ds.Clear();
       }
    }
        private static void Main(string[] args)
        {
            new DB("test", "localhost");
            // create seed data
            var seed = new Disclaimer
            {
                Overrides = new[]
                {
                    new Override
                    {
                        CategoryId = 666, EffectiveDate = DateTime.Now.AddDays(-1), Message = "disclaimer 1"
                    },
                    new Override
                    {
                        CategoryId = 666, EffectiveDate = DateTime.Now.AddDays(-1), Message = "disclaimer 2"
                    },
                    new Override
                    {
                        CategoryId = 777, EffectiveDate = DateTime.Now.AddDays(-1), Message = "disclaimer 3"
                    }
                }
            }; seed.Save();

            // start bulk update command
            DB.Update <Disclaimer>()
            // step1: set expiry date on existing 666s
            .Match(d => d.ID == seed.ID)
            .WithArrayFilter("{ 'x.CategoryId' : 666 }")
            .Modify(b => b.Set("Overrides.$[x].ExpiryDate", DateTime.Now))
            .AddToQueue()
            // step2: add a new 666
            .Match(d => d.ID == seed.ID)
            .Modify(b => b.Push(d => d.Overrides,
                                new Override
            {
                CategoryId    = 666,
                EffectiveDate = DateTime.Now,
                Message       = "disclaimer 4"
            }))
            .AddToQueue()
            // run two step bulk update command
            .Execute();
        }
        private static void Main(string[] args)
        {
            new DB("test");
            var members = new List <Member>();

            for (int i = 1; i <= 10; i++)
            {
                members.Add(new Member
                {
                    Sid = Guid.NewGuid().ToString()
                });
            }
            members.Save();
            DB.Update <Member>()
            .Match(_ => true)
            .WithPipelineStage("{ '$set': { 'Sids': ['$Sid'] } }")
            .WithPipelineStage("{ '$unset': ['Sid'] }")
            .ExecutePipeline();
        }
Пример #7
0
    protected void Button9_Click(object sender, EventArgs e)
    {
        //教师课题修改,当课题审批通过或者不在出题阶段时,无法进行修改

        DB db = new DB();

        String del = "update paperApply set  kind='" + this.kind_Mod.SelectedValue + "',project_Name='" + this.projectName_Mod.Text + "',project_Depart='" + this.projectDpart_Mod.Text + "',project_Num='" + this.projectNum_Mod.Text + "',target='" + this.aim_Mod.Text + "', aim_Meaning='" + this.mean_Mod.Text + "',current_situation='" + this.state_Mod.Text + "', content='" + this.cont_Mod.Text + "',reference='" + this.ref_Mod.Text + "',remark='" + this.remark_Mod.Text + "',schedule='" + this.TextBox8.Text + "' where id='" + Session["id"] + "'";

        if (db.Update(del, db.DBconn()))
        {
            //this.message.Text = "更新题目为" + this.DropDownList1.SelectedValue + "的数据成功";
            Response.Write("<script>alert('更新题目为" + this.Label2.Text + "的数据成功');location='paperOpe.aspx'</script>");
        }
        else
        {
            //  this.message.Text = "更新题目为" + this.DropDownList1.SelectedValue + "的数据失败";
            Response.Write("<script>alert('更新题目为" + this.Label2.Text + "的数据失败');location='paperOpe.aspx'</script>");
        }
    }
        public void SaveOptions(Question question, int rigthOption, params string[] options)
        {
            var count = 1;

            foreach (var text in options)
            {
                var option = new QuestionOption(question, text);
                SaveOption(option);

                if (count == rigthOption)
                {
                    question.RigthOptionId = option.Id;
                }

                count++;
            }

            DB.Update(question);
        }
Пример #9
0
        public async Task <IActionResult> Upload()
        {
            Microsoft.AspNetCore.Http.IFormCollection     formCollection = Request.Form;
            Microsoft.AspNetCore.Http.IFormFileCollection formFiles      = formCollection.Files;

            var    uploads = Path.Combine(he.WebRootPath, "docs");
            String DocsRutaNombreArchivo = "";
            //Boolean fileUploaded = false;

            var ventaRequisito = await DB.Ventas_VentaRequisito.FindAsync(0);

            for (var i = 0; i < formFiles.Count; i++)
            {
                if (i == 0)
                {
                    var file = formFiles[i];
                    if (file.Length > 0)
                    {
                        Int32  IdVentaRequisito    = Convert.ToInt32(file.FileName.Replace(".pdf", ""));
                        var    GeneraNombreArchivo = DB.Generales_fRetornaCadena.FromSql($"SELECT * FROM \"Ventas\".\"fGeneraNombreDocumento\"({IdVentaRequisito})").ToList();
                        String NombreArchivo       = GeneraNombreArchivo.FirstOrDefault().Cadena;
                        DocsRutaNombreArchivo += NombreArchivo;

                        var filePath = Path.Combine(uploads, NombreArchivo);
                        using (var fileStream = new FileStream(filePath, FileMode.Create))
                        {
                            await file.CopyToAsync(fileStream);

                            //fileUploaded = true;
                        }

                        ventaRequisito = await DB.Ventas_VentaRequisito.FindAsync(IdVentaRequisito);

                        ventaRequisito.PathArchivo    = DocsRutaNombreArchivo;
                        ventaRequisito.ArchivoCargado = true;
                        DB.Update(ventaRequisito);
                        await DB.SaveChangesAsync();
                    }
                }
            }
            //return fileUploaded;
            return(View(ventaRequisito));
        }
        private static void Main()
        {
            new DB("test", "localhost");
            var user = new User();

            user.DeviceActions.Add(ObjectId.GenerateNewId(), 100);
            user.DeviceActions.Add(ObjectId.GenerateNewId(), 200);
            user.DeviceActions.Add(ObjectId.GenerateNewId(), 300);
            user.Save();
            var userID = user.ID;
            var key    = user.DeviceActions.First().Key;

            DB.Update <User>()
            .Match(u =>
                   u.ID == userID &
                   u.DeviceActions.Any(a => a.Key == key))
            .Modify(b => b.Set("DeviceActions.$.v", 0))
            .Execute();
        }
Пример #11
0
        public async Task <IActionResult> Edit(Int32 id, Models.Finanzas.PlanCuentas item)
        {
            if (id != item.IdPlanCuentas)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    ApplicationUser currentUser = await GetCurrentUser();

                    item.IdUsuario          = currentUser.AspNetUserId;
                    item.IdPlanCuentasPadre = 0;
                    item.IdEstadoRegistro   = 1;
                    item.FechaRegistro      = DateTime.Now;
                    DB.Update(item);
                    await DB.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ItemExists(item.IdPlanCuentas))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
            }
            var items1 = DB.Auxiliar.
                         Where(i => i.IdEstadoRegistro != Constantes.Anulado).OrderBy(i => i.Descripcion).ToList();

            ViewBag.Auxiliar = items1;
            var items2 = DB.TipoCuentaBanco.
                         Where(i => i.IdEstadoRegistro != Constantes.Anulado).OrderBy(i => i.Descripcion).ToList();

            ViewBag.TipoCuentaBanco = items2;
            return(PartialView("Edit", item));
        }
Пример #12
0
        public bool Add_Update()
        {
            try
            {
                DB DataBase = new DB("customer_services");

                DataBase.AddColumn("cs_cus_id", Customer);
                DataBase.AddColumn("cs_date", Date_DTP.Value.Value.Date);
                DataBase.AddColumn("cs_value", Value_TB.Text);
                DataBase.AddColumn("cs_paid", Paid_TB.Text);
                DataBase.AddColumn("cs_ser_id", Service_CB.SelectedValue);


                if (this.Payment_Id == null)
                {
                    if (DataBase.IsNotExist("cs_id", "cs_cus_id", "cs_date", "cs_value", "cs_paid", "cs_ser_id"))
                    {
                        return(Confirm.Check(DataBase.Insert()));
                    }
                    else
                    {
                        // ye3ny hwa mawgood asln mesh ha3ml 7aga
                        Message.Show("هذا المستند موجود من قبل", MessageBoxButton.OK, 5);
                        return(false);
                        //DataBase.AddCondition("pl_id", this.placeId);
                        //DataBase.Update();
                    }
                }

// hena ye3ny hwa mawgod ba3mel edit
                else
                {
                    DataBase.AddCondition("cs_id", this.Payment_Id);

                    return(Confirm.Check(DataBase.Update()));
                }
            }
            catch
            {
                return(Confirm.Check(false));
            }
        }
Пример #13
0
        public bool Add_Update()
        {
            try
            {
                DB DataBase = new DB("outcome");

                DataBase.AddColumn("out_date", Date_TB.Text);
                DataBase.AddColumn("out_value", Value_TB.Text);
                DataBase.AddColumn("out_description", Description_TB.Text);
                DataBase.AddColumn("out_ott_id", Type_CB.SelectedValue);
                //DataBase.AddColumn("out_pon_id", Point_ID);



                if (this.Outcome_Id == null)
                {
                    if (DataBase.IsNotExist("out_id", "out_date", "out_value", "out_description", "out_ott_id", "out_pon_id"))
                    {
                        return(Confirm.Check(DataBase.Insert()));
                    }
                    else
                    {
                        // ye3ny hwa mawgood asln mesh ha3ml 7aga
                        Message.Show("هذا المستند موجود من قبل", MessageBoxButton.OK, 5);
                        return(false);
                        //DataBase.AddCondition("pl_id", this.placeId);
                        //DataBase.Update();
                    }
                }

// hena ye3ny hwa mawgod ba3mel edit
                else
                {
                    DataBase.AddCondition("out_id", this.Outcome_Id);
                    return(Confirm.Check(DataBase.Update()));
                }
            }
            catch
            {
                return(Confirm.Check(false));
            }
        }
        public async Task <IActionResult> Edit(Int32 id, Models.Planificacion.OrganismoFinanciador item)
        {
            if (id != item.IdOrganismoFinanciador)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    ApplicationUser currentUser = await GetCurrentUser();

                    item.IdUsuario          = currentUser.AspNetUserId;
                    item.Gestion            = Convert.ToString(DateTime.Now.Year);
                    item.IdBeneficiario     = 0;
                    item.IdPais             = 1;
                    item.CargoRepresentante = "-";
                    item.IdEstadoRegistro   = 1;
                    item.FechaRegistro      = DateTime.Now;
                    DB.Update(item);
                    await DB.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ItemExists(item.IdOrganismoFinanciador))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
            }
            var items = DB.FuenteFinanciamiento.
                        Where(i => i.IdEstadoRegistro != Constantes.Anulado).OrderBy(i => i.Descripcion).ToList();

            ViewBag.FuenteFinanciamiento = items;

            return(PartialView("Edit", item));
        }
Пример #15
0
 private void DragTB(TextBox dragElement, StackPanel destination)
 {
     if (dragElement.Name.Substring(0, 4) == "note")
     {
         Note dragNote = DB.GetNote(int.Parse(dragElement.Name.Substring(4)));
         dragNote.category_id = 1;
         if (dragNote.note_id == openNote.note_id)
         {
             openNote = dragNote;
         }
         DB.Update(dragNote);
     }
     else if (dragElement.Name.Substring(0, 4) == "cate")
     {
         NoteCategory dragCat = DB.GetNoteCategory(int.Parse(dragElement.Name.Substring(4)));
         dragCat.category_parent = 1;
         DB.Update(dragCat);
     }
     UpdateNotes();
 }
Пример #16
0
        private void ButtonNewAccount_Click(object sender, RoutedEventArgs e)
        {
            var accountWindow = new NewAccountWindow(_security);

            if (accountWindow.ShowDialog() == false)
            {
                Account = accountWindow.NewAccount;
                foreach (var acc in _users)
                {
                    if (acc.Login == Account.Login)
                    {
                        MessageBox.Show($"There is a user with {Account.Login} login!");
                        return;
                    }
                }
                _generalData.Users.Add(Account);
                DB.Update(_generalData);
                Json.Writer(_generalData);
            }
        }
Пример #17
0
        public bool Update(Site s)
        {
            string sql = string.Format(@"UPDATE Site SET ");

            sql += string.Format("LicensedSite='{0}', ", s.LicensedSite);
            sql += string.Format("TypeCatalogId={0}, ", s.TypeCatalogId);
            sql += string.Format("Customer={0}, ", s.Customer);
            sql += string.Format("BusinessUnit={0}, ", s.BusinessUnit);
            sql += string.Format("Region={0}, ", s.Region);
            sql += string.Format("District={0}, ", s.District);
            sql += string.Format("LTGroup={0}, ", s.LTGroup);
            sql += string.Format("ProgramStartDate='{0}', ", s.ProgramStartDate);
            sql += string.Format("StartofValidData='{0}', ", s.StartOfValidData);
            sql += string.Format("VolumeAdjust={0}, ", s.VolumeAdjust);
            sql += string.Format("Active='{0}', ", s.Active);
            sql += string.Format("ModifiedDate='{0}' ", s.ModifiedDate);
            sql += string.Format("where Id={0}", s.Id);

            return(DB.Update(sql));
        }
Пример #18
0
 private void BtnFavorite(object sender, RoutedEventArgs e)
 {
     if (openNote != null)
     {
         if (openNote.is_favorite == 1)
         {
             openNote.is_favorite = 0;
             DB.Update(openNote);
             Favorite.ToolTip = "Add to Favorites";
             ((TextBlock)Favorite.Content).Text = "Add to Favorites";
         }
         else if (openNote.is_favorite == 0)
         {
             openNote.is_favorite = 1;
             DB.Update(openNote);
             Favorite.ToolTip = "Remove from Favorites";
             ((TextBlock)Favorite.Content).Text = "Remove from Favorites";
         }
     }
 }
Пример #19
0
        public virtual void SaveToDatabase(DB database)
        {
            database.RunInTransaction(() =>
            {
                foreach (var deckId in ToRemoveFromDatabaseList)
                {
                    database.Delete <InkPreference>(deckId);
                }

                foreach (var deckId in ToAddToDatabaseDeckList)
                {
                    database.InsertOrReplace(deckPrefDict[deckId]);
                }

                foreach (var deckId in ToUpdateToDatabaseDeckDict.Keys)
                {
                    database.Update(deckPrefDict[deckId]);
                }
            });
        }
        public bool Update(PlanTimeJob plan, List <string> propertylist)
        {
            Console.WriteLine("DOCPlanTimeJobDAL-Update():" + DateTime.Now);

            try
            {
                if (CheckPlanJob(plan))
                {
                    throw new Exception(string.Format("Plan already Exist! {0} - {1} - {2}", plan.SampleName, plan.LOT_NO, plan.LINE));
                }

                return(db.Update(plan));
            }
            catch (Exception e)
            {
                log.Error(e);

                throw new Exception(e.Message);
            }
        }
Пример #21
0
        private void BtnDeleteNote(object sender, RoutedEventArgs e)
        {
            if (openNote != null)
            {
                foreach (Pin p in DB.getPins())
                {
                    if (p.attached_note_id == openNote.note_id)
                    {
                        p.attached_note_id = 0;
                        DB.Update(p);
                    }
                }

                DB.DeleteNote(openNote.note_id);
                openNote = null;
                Properties.Settings.Default.currentNote = null;
                rtbEditor.Visibility = Visibility.Hidden;
                UpdateNotes();
            }
        }
Пример #22
0
        public async Task <IActionResult> CargaArchivo(int id, [Bind("IdVentaRequisito,IdVentaContratacion,IdBeneficiario,IdDocumentoRespaldo,IdDocumentoFormato,DocumentoEntregado,PathArchivo,ArchivoCargado,IdEstadoRegistro,IdUsuario,FechaRegistro")] VentaRequisito ventaRequisito, IFormFile ArchivoPDF)
        {
            //if (id != ventaRequisito.IdVentaRequisito)
            //{
            //	return NotFound();
            //}
            Int32 IdVentaContratacion;

            if (ModelState.IsValid)
            {
                try
                {
                    String fileName = "";
                    if (ArchivoPDF != null)
                    {
                        fileName = Path.Combine(he.WebRootPath, Path.GetFileName(ArchivoPDF.FileName));
                        ArchivoPDF.CopyTo(new FileStream(fileName, FileMode.Create));
                    }

                    ventaRequisito.PathArchivo    = fileName;
                    ventaRequisito.ArchivoCargado = true;
                    IdVentaContratacion           = ventaRequisito.IdVentaContratacion;

                    DB.Update(ventaRequisito);
                    await DB.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VentaRequisitoExists(ventaRequisito.IdVentaRequisito))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index", "VentaRequisito", new { Id = IdVentaContratacion }));
            }
            return(View(ventaRequisito));
        }
Пример #23
0
 private static void Main(string[] args)
 {
     new DB("test");
     var doc = new Document();
     doc.Save();
     var sub1 = new SubDocument { Name = "houston" };
     var sub2 = new SubDocument { Name = "california" };
     for (int i = 0; i <= 5; i++)
     {
         DB.Update<Document>()
           .Match(d => d.ID == doc.ID)
           .Modify(b => b.AddToSet(d => d.SubDocs, sub1))
           .Execute();
         DB.Update<Document>()
           .Match(d => d.ID == doc.ID)
           .Modify(b => b.AddToSet(d => d.SubDocs, sub2))
           .Execute();
     }
     Console.WriteLine($"sub document count is: {doc.SubDocCount()}"); // result is 2
     Console.Read();
 }
Пример #24
0
 private void SetUneditable(object sender, RoutedEventArgs e)
 {
     editedTitle            = sender as TextBox;
     editedTitle.IsReadOnly = true;
     editedTitle.Cursor     = Cursors.Arrow;
     if (editedTitle.Name.Substring(0, 4) == "cate")
     {
         NoteCategory nc = DB.GetNoteCategory(int.Parse(editedTitle.Name.Substring(4)));
         nc.category_title = editedTitle.Text;
         DB.Update(nc);
     }
     else if (editedTitle.Name.Substring(0, 4) == "note")
     {
         Note n = DB.GetNote(int.Parse(editedTitle.Name.Substring(4)));
         if (n != null)
         {
             n.note_title = editedTitle.Text;
             DB.Update(n);
         }
     }
 }
Пример #25
0
        public async Task <IActionResult> Edit(Int32 id, Models.Administra.Almacen item)
        {
            if (id != item.IdAlmacen)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    ApplicationUser currentUser = await GetCurrentUser();

                    item.IdUsuario        = currentUser.AspNetUserId;
                    item.IdEstadoRegistro = 1;
                    item.FechaRegistro    = DateTime.Now;
                    DB.Update(item);
                    await DB.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ItemExists(item.IdAlmacen))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
            }

            // Datos para las dropdownlist's
            ViewBag.TipoAlmacen = DB.TipoAlmacen.Where(i => i.IdEstadoRegistro != Constantes.Anulado).OrderBy(i => i.Descripcion).ToList();
            ViewBag.Municipio   = DB.Municipio.Where(i => i.IdEstadoRegistro != Constantes.Anulado).OrderBy(i => i.Descripcion).ToList();
            ViewBag.Barrio      = DB.Barrio.Where(i => i.IdEstadoRegistro != Constantes.Anulado).OrderBy(i => i.Descripcion).ToList();
            ViewBag.Calle       = DB.Calle.Where(i => i.IdEstadoRegistro != Constantes.Anulado).OrderBy(i => i.Descripcion).ToList();

            return(PartialView("Edit", item));
        }
Пример #26
0
        async public Task <Boolean> Run(string businessCode, string username, string password)
        {
            //var rezz = await WebServiceFunc.Login(businessCode, username, password);

            UIFunc.ShowLoading("Authorization...");
            var url0 = "Authenticate?businessCode=" + Uri.EscapeDataString(businessCode)
                       + "&username="******"&password="******"Error in authorization procedure");

                return(false);
            }

            var result = WebServiceFunc.DeserializeObjectFromStream <AuthenticateReturn>(rez.Value);

            if (!String.IsNullOrEmpty(result.Error))
            {
                UIFunc.HideLoading();
                await UIFunc.AlertError(result.Error);

                return(false);
            }

            var optrow = UserOptions.GetCurrent();

            optrow.Username      = username;
            optrow.Password      = password;
            optrow.UserRowId     = result.UserRowId;
            optrow.BusinessRowId = result.BusinessRowId;
            optrow.BusinessCode  = result.BusinessCode;
            DB.Update(optrow);

            UIFunc.HideLoading();
            return(true);
        }
Пример #27
0
        public bool Add_Update()
        {
            try
            {
                DB DataBase = new DB("employee_tax_bonus");

                DataBase.AddColumn("emh_emp_id", Employee_Id);
                DataBase.AddColumn("emh_date", Date_TB.Text);
                DataBase.AddColumn("emh_reason", Reason_TB.Text);
                DataBase.AddColumn("emh_value", Value_TB.Text);
                DataBase.AddColumn("emh_nm_id", Employee_Tax_bonus_CB.SelectedValue);

                if (this.Tax_Bonus_id == null)
                {
                    if (DataBase.IsNotExist("emh_id", "emh_emp_id", "emh_date", "emh_reason", "emh_value", "emh_nm_id"))
                    {
                        return(Confirm.Check(DataBase.Insert()));
                    }
                    else
                    {
                        // ye3ny hwa mawgood asln mesh ha3ml 7aga
                        Message.Show("هذا المستند موجود من قبل", MessageBoxButton.OK, 5);
                        return(false);
                        //DataBase.AddCondition("pl_id", this.placeId);
                        //DataBase.Update();
                    }
                }

// hena ye3ny hwa mawgod ba3mel edit
                else
                {
                    DataBase.AddCondition("emh_id", this.Tax_Bonus_id);
                    return(Confirm.Check(DataBase.Update()));
                }
            }
            catch
            {
                return(false);
            }
        }
        private static void Main(string[] args)
        {
            new DB("test");
            var convo = new Conversation
            {
                LastSent = DateTime.Now.AddMinutes(-10),
                Messages = new[] { new Message {
                                       Content = "This is the first message..."
                                   } }
            };

            convo.Save();
            var msg = new Message {
                Content = "This is a new message..."
            };

            DB.Update <Conversation>()
            .Match(c => c.ID == convo.ID)
            .Modify(c => c.LastSent, DateTime.Now)
            .Modify(b => b.Push(c => c.Messages, msg))
            .Execute();
        }
    protected void Button3_Click(object sender, EventArgs e)
    {
        DB            db   = new DB();
        SqlConnection conn = db.DBconn();
        DateTime      now  = DateTime.Today;

        //获取教师信息

        string teacher_ID = Session["teacher_ID"].ToString();

        string title        = this.Label1.Text;
        string teacher_Name = Session["teacher_Name"].ToString();

        //获取领导信息
        string lead_ID   = Session["username"].ToString();
        string lead_Name = Session["name"].ToString();
        //获取文本信息
        String state   = this.RadioButtonList1.SelectedValue;
        String content = this.TextBox7.Text;

        if (content == "")
        {
            Response.Write("<script>alert('审批内容不能为空!');</script>");
            return;
        }
        string insert = "insert into TtoLContent(teacher_ID,lead_ID,title,time,state,content,teacher_Name,lead_Name,role,paperid) values('" + teacher_ID + "','" + lead_ID + "','" + title + "','" + now + "','" + state + "','" + content + "','" + teacher_Name + "','" + lead_Name + "','" + Session["role"] + "','" + Session["paperid"] + "')";

        String update = "update paperApply set state1='" + state + "' where teacher_ID='" + teacher_ID + "'and title='" + title + "'";

        // db.Update(update, conn);
        if (db.Insert(insert, conn) && db.Update(update, conn))
        {
            Response.Write("<script>alert('审核成功!');location='departExamine.aspx'</script>");
        }
        else
        {
            Response.Write("<script>alert('审核失败!');location='departExamine.aspx'</script>");
        }
    }
Пример #30
0
        public async Task <IActionResult> Edit(Int32 id, Models.Generales.Municipio item)
        {
            if (id != item.IdMunicipio)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    ApplicationUser currentUser = await GetCurrentUser();

                    item.IdUsuario        = currentUser.AspNetUserId;
                    item.IdRegion         = 0;
                    item.IdEstadoRegistro = 1;
                    item.FechaRegistro    = DateTime.Now;
                    DB.Add(item);
                    DB.Update(item);
                    await DB.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ItemExists(item.IdMunicipio))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
            }
            var items = DB.Provincia.
                        Where(i => i.IdEstadoRegistro != Constantes.Anulado).OrderBy(i => i.Descripcion).ToList();

            ViewBag.Provincia = items;
            return(PartialView("Edit", item));
        }
Пример #31
0
        public bool Update(FoodType ls)
        {
            string sql = string.Format(@"UPDATE FoodType SET CatID={0}, ", ls.CatId);

            sql += string.Format("TypeName='{0}', ", ls.Name);
            sql += string.Format("ReportTypeName='{0}', ", ls.ReportName);
            sql += string.Format("SpanishTypeName='{0}', ", ls.SpanishName);
            sql += string.Format("Cost='{0}', ", ls.Cost);
            sql += string.Format("Rank='{0}', ", ls.Rank);
            sql += string.Format("Enabled='{0}', ", ls.Enabled);
            sql += string.Format("ModifiedDate='{0}', ", ls.ModifiedDate);
            sql += string.Format("Description='{0}', ", ls.Description);
            sql += string.Format("SpareProperty1='{0}', ", ls.SpareProperty1);
            sql += string.Format("SpareProperty2='{0}', ", ls.SpareProperty2);
            sql += string.Format("SpareProperty3='{0}', ", ls.SpareProperty3);
            sql += string.Format("VolumeWeight='{0}', ", ls.VolumeWeight);
            sql += string.Format("VolumeUnits='{0}', ", ls.VolumeUnits);
            sql += string.Format("VolumeUnitType='{0}', ", ls.VolumeUnitType);
            sql += string.Format("WasteClass='{0}' ", ls.WasteClass);
            sql += string.Format("WHERE TypeID='{0}'", ls.Id);
            return(DB.Update(sql));
        }
Пример #32
0
        private bool add_image(object id)
        {
            try
            {
                DB DataBase = new DB("height_weight");
                DataBase.AddCondition("hw_id", id);

                if (!Img.Source.ToString().StartsWith("pack") && !Img.Source.ToString().StartsWith("System"))
                {
                    string path = "D:\\GYM";
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }
                    string newImagePage = path + "\\" + id + ".jpg";

                    File.Copy(Img.Source.ToString().Remove(0, 8), newImagePage, true);

                    DataBase.AddColumn("hw_img", newImagePage);

                    if (DataBase.Update())
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(true);
                }
            }
            catch
            {
                return(false);
            }
        }
Пример #33
0
        /// <summary>
        /// 更新一个角色
        /// </summary>
        /// <param name="model">角色信息</param>
        public void UpdateRole(RoleModel model)
        {
            SqlParameterCollection spc = DB.CreateSqlParameterCollection();

            spc.Add("@RoleID", model.RoleID);

            string    sql = "select * from g_Role where RoleID=@RoleID";
            DataTable dt  = DB.ExeSqlForDataTable(sql, spc, "t");

            if (dt.Rows.Count != 1)
            {
                return;
            }

            DataRow dr = dt.Rows[0];

            dr["RoleName"] = model.RoleName;
            dr["RoleDesc"] = model.RoleDesc;
            dr["Sort"]     = model.Sort;

            DB.Update(sql, spc, dt);
        }
        public async Task nested_properties_update_correctly()
        {
            var guid = Guid.NewGuid().ToString();

            var book = new Book
            {
                Title  = "mnpuc title " + guid,
                Review = new Review {
                    Rating = 10.10
                }
            };
            await book.SaveAsync();

            await DB.Update <Book>()
            .Match(b => b.Review.Rating == 10.10)
            .Modify(b => b.Review.Rating, 22.22)
            .ExecuteAsync();

            var res = await DB.Find <Book>().OneAsync(book.ID);

            Assert.AreEqual(22.22, res.Review.Rating);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["username"] == null)
        {
            Response.Write("<script>alert('用户登录超时,请重新登录。');location='../Default.aspx'</script>");
            return;
        
        }
        
        if (!Page.IsPostBack)
        {
            this.GridView1.Visible = true;
            this.GridView2.Visible = false;
        }
        DB db = new DB();
       
        string role = Session["role"].ToString();
        if (role == "院领导")//权限判定
        {
        }
        else
        {
            Response.Write("<script language='javascript'>alert('你的角色为" + role + ",不可以进入院领导审核页面!');location='Default.aspx'</script>");
        }
        //chushi进入页面需要更新或加载数据
        string sel = "select * from student where  grade='"+Session["year1"].ToString()+"'";//依次查询本届学生信息
        DataSet ds = db.Select(sel,db.DBconn());
        try
        {
            foreach (DataRow studentInfo in ds.Tables[0].Rows)//获取学生数据后,在监督表中查找,有更新,无插入
            {
               //在此之前,需要分别查找select_Result,studentTask,STReport,guiMark,aimCom,并查找论文目录
                int select_Result=0;
                int studentTask=0;
                int STReport=0;
                int guiMark=0;
                int aimCom=0;   
                int fileUpload=0;
               /*****************************************************************************************************************/
                //查询选课结果表
                string sel1="select * from select_Result where student_ID='" + studentInfo["student_ID"].ToString()+ "'";
                 DataSet ds2=db.Select(sel1,db.DBconn());
                 select_Result=ds2.Tables[0].Rows.Count;
                 string paperid = "";
                 string title = "";
                 try
                 {
                     paperid = ds2.Tables[0].Rows[0][8].ToString();
                     title = ds2.Tables[0].Rows[0][6].ToString();

                 }
                 catch
                 {
                     //Response.Write("<script>alert('数据库查询选课结果表时出错。');location='Default.aspx'</script>");
                 }
                 finally
                 {
                     ds2.Clear();
                 }
                 
                   
                 //查询学生任务书表
                 sel1="select * from studentTask where student_ID='" + studentInfo["student_ID"].ToString()+ "'";
                  ds2=db.Select(sel1,db.DBconn());
                 studentTask=ds2.Tables[0].Rows.Count;
                   ds2.Clear();
                 //查询开题报告表
                 sel1="select * from STReport where student_ID='" + studentInfo["student_ID"].ToString()+ "'";
                 ds2=db.Select(sel1,db.DBconn());
                  STReport=ds2.Tables[0].Rows.Count;
                   ds2.Clear();
                 //查询指导记录表
                sel1="select * from guiMark where student_ID='" + studentInfo["student_ID"].ToString()+ "'";
                  ds2=db.Select(sel1,db.DBconn());
                  guiMark=ds2.Tables[0].Rows.Count;
                  ds2.Clear();
                 //查询论文小结表
                 sel1="select * from aimCom where student_ID='" + studentInfo["student_ID"].ToString()+ "'";
                  ds2=db.Select(sel1,db.DBconn());
                  aimCom=ds2.Tables[0].Rows.Count;
                  ds2.Clear();
                //查询论文是否上传
                 String fileName =  studentInfo["student_ID"].ToString() +  studentInfo["name"].ToString()+title;
                if (File.Exists(Server.MapPath("../论文上传/" + fileName+ ".doc"))||System.IO.File.Exists(Server.MapPath("../论文上传/" + fileName+ ".docx")))//如果不存在就为0
                {
                    fileUpload=1;
                }else{
                     fileUpload=0;
                }

                /*****************************************************************************************************************/
                string student = "select * from inspect where student_ID='" + studentInfo["student_ID"].ToString()+ "'";
                DataSet ds1 = db.Select(student, db.DBconn());
                try//有数据则更新数据
                {
                    string paperid1 = ds1.Tables[0].Rows[0][3].ToString();//用来跳转到catch
                    if (select_Result > 0)//存在则更新
                    {
                        string update = "update inspect set paperid='" + paperid + "',title='" + title + "' where student_ID='" + studentInfo["student_ID"].ToString() + "'";//然后更新学生数据
                        db.Update(update, db.DBconn());
                    }
                    if (studentTask > 0)//存在则更新
                    {
                        string update = "update inspect set studentTaskPaper='已填写' where student_ID='" + studentInfo["student_ID"].ToString() + "'";//然后更新学生数据//然后更新学生数据
                        db.Update(update, db.DBconn());
                    }
                    if (STReport > 0)//存在则更新
                    {
                        string update = "update inspect set STReport='已填写' where student_ID='" + studentInfo["student_ID"].ToString() + "'";//然后更新学生数据//然后更新学生数据
                        db.Update(update, db.DBconn());
                    }
                    if (guiMark > 0)//存在则更新
                    {
                        string update = "update inspect set GuiNum='" + guiMark + "' where student_ID='" + studentInfo["student_ID"].ToString() + "'";//然后更新学生数据//然后更新学生数据
                        db.Update(update, db.DBconn());
                    }
                    if (aimCom > 0)//存在则更新
                    {
                        string update = "update inspect set Summ='已填写' where student_ID='" + studentInfo["student_ID"].ToString() + "'";//然后更新学生数据//然后更新学生数据
                        db.Update(update, db.DBconn());
                    }

                    if (fileUpload > 0)//存在则更新
                    {
                        string update = "update inspect set IsUpLoad='已上传' where student_ID='" + studentInfo["student_ID"].ToString() + "'";//然后更新学生数据//然后更新学生数据
                        db.Update(update, db.DBconn());
                    }


                }
                catch//无数据则插入数据
                {
                    string insert = "insert into inspect(student_ID,student_Name,grade,specialty,class) values('" + studentInfo["student_ID"].ToString() + "','" + studentInfo["name"].ToString() + "','" + studentInfo["grade"].ToString() + "','" + studentInfo["specialty"].ToString() + "','" + studentInfo["class"].ToString() + "')";//首先插入学生数据
                    db.Insert(insert,db.DBconn());
                    //然后更新各个数据
                    if (select_Result>0)//存在则更新
                    {
                        string update = "update inspect set paperid='" + paperid + "',title='" + title + "' where student_ID='" + studentInfo["student_ID"].ToString() + "'";//然后更新学生数据
                        db.Update(update, db.DBconn());
                    }
                    if (studentTask > 0)//存在则更新
                    {
                        string update = "update inspect set studentTaskPaper='已填写' where student_ID='" + studentInfo["student_ID"].ToString() + "'";//然后更新学生数据//然后更新学生数据
                        db.Update(update, db.DBconn());
                    }
                    if (STReport> 0)//存在则更新
                    {
                        string update = "update inspect set STReport='已填写' where student_ID='" + studentInfo["student_ID"].ToString() + "'";//然后更新学生数据//然后更新学生数据
                        db.Update(update, db.DBconn());
                    }
                    if (guiMark > 0)//存在则更新
                    {
                        string update = "update inspect set GuiNum='" + guiMark + "' where student_ID='" + studentInfo["student_ID"].ToString() + "'";//然后更新学生数据//然后更新学生数据
                        db.Update(update, db.DBconn());
                    }
                    if (aimCom > 0)//存在则更新
                    {
                        string update = "update inspect set Summ='已填写' where student_ID='" + studentInfo["student_ID"].ToString() + "'";//然后更新学生数据//然后更新学生数据
                        db.Update(update, db.DBconn());
                    }

                    if (fileUpload > 0)//存在则更新
                    {
                        string update = "update inspect set IsUpLoad='已上传' where student_ID='" + studentInfo["student_ID"].ToString() + "'";//然后更新学生数据//然后更新学生数据
                        db.Update(update, db.DBconn());
                    }
                    ds1.Clear();
                    Response.Redirect("inspect.aspx");

                }
                finally
                {
                    ds1.Clear();
                }
               
            }

        }
        catch
        {
            Response.Write("<script language='javascript'>alert('获取学生数据错误,查看是否存在本届学生数据!');location='Default.aspx'</script>");
        }
        finally
        {
            ds.Clear();
        }


        


    }
    protected void Button1_Click(object sender, EventArgs e)
    {
         DB db=new DB();
        //首先判断教师中期中数据
     
        string sel="select * from midCheckForTea where teacher_ID='"+Session["username"]+"'";
        DataSet ds=db.Select(sel,db.DBconn());
        if(ds.Tables[0].Rows.Count>0){//有数据则更新操作
            string update="update midCheckForTea set IsOne='"+this.RadioButtonList1.SelectedValue+"',IsTaskGive='"+this.RadioButtonList2.SelectedValue+"',IsrefRead='"+this.RadioButtonList3.SelectedValue+"',IsGuided='"+this.RadioButtonList4.SelectedValue+"',totalsituation='"+this.RadioButtonList5.SelectedValue+"',QA='"+this.TextBox1.Text+"' where teacher_ID='"+Session["username"]+"'";
            if (!db.Update(update, db.DBconn()))
            {   
            Response.Write("<script>alert('中期检查教师表修改失败。');location='midCheckEA.aspx'</script>");
            }

        }else{//无数据则进行插入

            String insert="insert into midCheckForTea(teacher_ID,teacher_Name,Depart,specify,time,guiNum,IsOne,IsTaskGive,IsrefRead,IsGuided,totalsituation,QA,year) values('"+Session["username"]+ "','" + Label4.Text + "','" + Label1.Text+ "','" + Label2.Text + "','" + Label3.Text+ "','" + Label5.Text + "','" +this.RadioButtonList1.SelectedValue  + "','" +this.RadioButtonList2.SelectedValue + "','" + this.RadioButtonList3.SelectedValue  + "','" +this.RadioButtonList4.SelectedValue + "','" +this.RadioButtonList5.SelectedValue + "','" +this.TextBox1.Text + "','" +Session["year"] +"')";
            if (!db.Insert(insert, db.DBconn()))
            {
                Response.Write("<script>alert('中期检查教师表填写失败。');location='midCheckEA.aspx'</script>");
            }

        }
        ds.Clear();
//按照学生情况进行操作***********************************************************************
        if (Button1.Text == "提交")//插入操作
        {
           
             //查找是否存在于表中如果存在则相当已修改,不存在为插入
            string kind=this.RadioButtonList6.SelectedValue;
            if(this.RadioButtonList6.SelectedValue.Equals("其他")&&this.TextBox2.Visible)
            {
                kind = this.TextBox2.Text;
            }
            String insert = "insert into midCheckForStu(teacher_ID,student_ID,student_Name,paperid,title,kind,Ischanged,IsReq,IsCom,Attitude,quality,result,state) values('" + Session["username"] + "','" + Session["student_ID"] + "','" + Label6.Text + "','" + Session["paperid"] + "','" + Label8.Text + "','" +kind + "','" +RadioButtonList7.SelectedValue  + "','" + RadioButtonList8.SelectedValue  + "','" + RadioButtonList9.SelectedValue + "','" + RadioButtonList10.SelectedValue  + "','" +RadioButtonList11.SelectedValue  + "','" + RadioButtonList12.SelectedValue +"','"+"已填写" + "') ";
           if(db.Insert(insert,db.DBconn())){
               Response.Write("<script>alert('中期检查填写成功。');location='midCheckEA.aspx'</script>");
           }
            else{
                Response.Write("<script>alert('中期检查填写失败。');location='midCheckEA.aspx'</script>");
            }
       
        }
        else//更新操作
        {
             string kind=this.RadioButtonList6.SelectedValue;
            if(this.RadioButtonList6.SelectedValue.Equals("其他")&&this.TextBox2.Visible)
            {
                kind=this.TextBox2.Text;

            }

            String update = "update midCheckForStu set kind='" + kind + "',Ischanged='" + this.RadioButtonList7.SelectedValue + "',IsReq='" + this.RadioButtonList8.SelectedValue + "',IsCom='" + this.RadioButtonList9.SelectedValue + "',Attitude='" + this.RadioButtonList10.SelectedValue + "',quality='" + this.RadioButtonList11.SelectedValue + "',result='" + this.RadioButtonList12.SelectedValue + "' where student_ID='" + Session["student_ID"].ToString().Trim() + "'";
            
            if (db.Update(update, db.DBconn()))
            {
                Response.Write("<script>alert('中期检查更新成功。');location='midCheckEA.aspx'</script>");
            }
            else
            {
                Response.Write("<script>alert('中期检查更新失败。');location='midCheckEA.aspx'</script>");
            }
       
       
    }
    }
    public void select(int PRI, int Select){
         DB db = new DB(); 
   
        //获取学生信息
        string student_ID = Session["username"].ToString();
        string name =  Session["name"].ToString();
        String sel = "select * from student where student_ID='" +student_ID+"'";
        DataSet ds = db.Select(sel,db.DBconn());
         String class1="";
         String grade = "";
        try
        {
         class1 = ds.Tables[0].Rows[0][13].ToString();
         grade = ds.Tables[0].Rows[0][15].ToString();
         ds.Clear();
        }
        catch
        {
            Response.Write("<script>alert('数据库出错,获取学生信息错误。');location='studentSelect.aspx'</script>");
        }

        //获取论文信息
      
        string teacher_ID=Request.QueryString["teacher_ID"];
          sel = "select * from paperApply where id='" +Session["paperid"]+ "'";
           ds = db.Select(sel, db.DBconn());
          String title = "";
          String teacher_Name = "";
          String direction = "";
          String introduce = "";
          String paperid = "";
          try
          {

               title =ds.Tables[0].Rows[0][3].ToString();
               teacher_Name = Convert.ToString(ds.Tables[0].Rows[0][20].ToString());
               direction = ds.Tables[0].Rows[0][4].ToString();
               introduce =ds.Tables[0].Rows[0][13].ToString();
               paperid=ds.Tables[0].Rows[0][0].ToString();
              ds.Clear();

          }
          catch
          {
              Response.Write("<script>alert('数据库出错,获取教师信息错误。');location='studentSelect.aspx'</script>");
          }

        int priority = PRI;
        Response.Write("<script>if(confirm('这将是您的第" + priority + "志愿,是否选定?选定后如需修改只能通过删除重选。')){ } else{location='Default.aspx'}</script>");
        string insert1 = "insert into themeSelectedResult(student_ID,name,class,teacher_ID,teacher_name,title,direction,introduce,priority,grade,paperid)  values('" + student_ID + "','" + name + "','" + class1 + "','" + teacher_ID + "','" + teacher_Name + "','" + title + "','" + direction + "','" + introduce + "','" + priority + "','" + grade + "','" + paperid + "')";//导入数据
        Select++;
        string update = "";
        if (priority == 1)
        {
             update = "update paperApply set first_select='" + Select + "' where id='" + paperid + "'";//更新选题情况信息
        }
        if (priority == 2)
        {
             update = "update paperApply set second_select='" + Select + "' where id='" + paperid + "'";//更新选题情况信息
        }
        if (priority == 3)
        {
            update = "update paperApply set third_select='" + Select + "' where id='" + paperid + "'";//更新选题情况信息
        }

        if (db.Insert(insert1, db.DBconn()) && db.Update(update, db.DBconn()))
        {
            Response.Write("<script>alert('您的课题第" + priority + "志愿选择成功');location='studentSelect.aspx'</script>");
        }

        else
        {
            Response.Write("<script>alert('您的课题第" + priority + "志愿选择失败');location='studentSelect.aspx'</script>");
        }
    }
Пример #38
0
        private bool Add_Update()
        {
            try
            {

                DB DataBase = new DB("Properties");

                DataBase.AddColumn("prp_name", Property_TB.Text.Trim());
                DataBase.AddColumn("prp_cat_id", Categories_CB.SelectedValue, Categories_CB.SelectedIndex < 1);

                if(Property_Id == null)
                {
                    if(Categories_CB.SelectedIndex < 1)
                    {
                        if(DataBase.IsNotExist("prp_id", "prp_name"))
                        {
                            return Confirm.Check(DataBase.Insert());
                        }
                        else
                        {
                            Message.Show("لقد تم تسجيل هذه الصفة من قبل", MessageBoxButton.OK, 5);
                            return false;
                        }
                    }
                    else
                    {
                        if(DataBase.IsNotExist("prp_id", "prp_name", "prp_cat_id"))
                        {
                            return Confirm.Check(DataBase.Insert());
                        }
                        else
                        {
                            Message.Show("لقد تم تسجيل هذه الصفة من قبل", MessageBoxButton.OK, 5);
                            return false;
                        }
                    }



                }
                else
                {
                    DataBase.AddCondition("prp_id", this.Property_Id);
                    return Confirm.Check(DataBase.Update());
                }
            }
            catch
            {
                //MessageBox.Show("kiki_method");
                return false;
            }
        }
Пример #39
0
        private bool Add_Update()
        {
            try
            {

                DB DataBase = new DB("points");

                DataBase.AddColumn("pon_name", Point_TB.Text.Trim());
                DataBase.AddColumn("pon_type", Type_CB.SelectedIndex - 1);
                if(Point_Id == null)
                {
                    if(DataBase.IsNotExist("pon_id", "pon_name", "pon_type"))
                    {
                        return Confirm.Check(DataBase.Insert());
                    }
                    else
                    {
                        Message.Show("لقد تم تسجيل هذه النقطة من قبل", MessageBoxButton.OK, 5);
                        return false;
                    }


                }
                else
                {
                    DataBase.AddCondition("pon_id", this.Point_Id);
                    return Confirm.Check(DataBase.Update());
                }
            }
            catch
            {
                //MessageBox.Show("kiki_method");
                return false;
            }
        }
Пример #40
0
        public bool Add_Update()
        {
            try
            {
                DB DataBase = new DB("users");
                if(Password_TB.Text.Equals(RePassword_TB.Text))
                {
                    if(this.User_Id == null)
                    {
                        DataBase.AddColumn("user_name", Name_TB.Text);
                        DataBase.AddColumn("user_pass", Password_TB.Text.Trim().GetHashCode());
                        DataBase.AddColumn("user_grp_id", Groups_CB.SelectedValue);

                        if(DataBase.IsNotExist("user_id", "user_name"))
                        {
                            return DataBase.Insert();
                        }
                        else
                        {
                            Message.Show("هذا الاسم مستخدم من قبل", MessageBoxButton.OK, 5);
                            return false;
                        }
                    }
                    else
                    {
                        switch(Edit_Mode)
                        {
                            case Edit_Mode.Edit:
                                DataBase.AddColumn("user_name", Name_TB.Text);
                                DataBase.AddColumn("user_grp_id", Groups_CB.SelectedValue);
                                break;
                            case Edit_Mode.Change_Password:
                                DataBase.AddColumn("user_pass", Password_TB.Text.Trim().GetHashCode());
                                break;
                        }
                        DataBase.AddCondition("user_id", this.User_Id);
                        return DataBase.Update();
                    }
                }
                else
                {
                    Message.Show("كلمة المرور غير متطابقة", MessageBoxButton.OK, 10);
                    return false;
                }
            }
            catch
            {
                return false;
            }

        }
    protected void Button9_Click(object sender, EventArgs e)
    {
        //教师课题修改,当课题审批通过或者不在出题阶段时,无法进行修改

        DB db = new DB();

        String del = "update paperApply set  kind='" + this.kind_Mod.SelectedValue + "',project_Name='" + this.projectName_Mod.Text + "',project_Depart='" + this.projectDpart_Mod.Text + "',project_Num='" + this.projectNum_Mod.Text + "',target='" + this.aim_Mod.Text + "', aim_Meaning='" + this.mean_Mod.Text + "',current_situation='" + this.state_Mod.Text + "', content='" + this.cont_Mod.Text + "',reference='" + this.ref_Mod.Text + "',remark='" + this.remark_Mod.Text + "',schedule='" + this.TextBox8.Text + "' where id='" + Session["id"] + "'";

        if (db.Update(del, db.DBconn()))
        {
            //this.message.Text = "更新题目为" + this.DropDownList1.SelectedValue + "的数据成功";
            Response.Write("<script>alert('更新题目为" + this.Label2.Text + "的数据成功');location='paperOpe.aspx'</script>");
        }
        else
        {
            //  this.message.Text = "更新题目为" + this.DropDownList1.SelectedValue + "的数据失败";
            Response.Write("<script>alert('更新题目为" + this.Label2.Text + "的数据失败');location='paperOpe.aspx'</script>");
        }
    }
Пример #42
0
        public bool Add_Update()
        {
            try
            {

                DB DataBase = new DB("outcome");

                DataBase.AddColumn("out_date", Date_TB.Text);
                DataBase.AddColumn("out_value", Value_TB.Text);
                DataBase.AddColumn("out_description", Description_TB.Text);
                DataBase.AddColumn("out_ott_id", Type_CB.SelectedValue);
                //DataBase.AddColumn("out_pon_id", Point_ID);



                if (this.Outcome_Id == null)
                {
                    if (DataBase.IsNotExist("out_id", "out_date", "out_value", "out_description", "out_ott_id", "out_pon_id"))
                    {
                        return Confirm.Check(DataBase.Insert());
                    }
                    else
                    {
                        // ye3ny hwa mawgood asln mesh ha3ml 7aga 
                        Message.Show("هذا المستند موجود من قبل", MessageBoxButton.OK, 5);
                        return false;
                        //DataBase.AddCondition("pl_id", this.placeId);
                        //DataBase.Update();

                    }


                }

// hena ye3ny hwa mawgod ba3mel edit
                else
                {
                    DataBase.AddCondition("out_id", this.Outcome_Id);
                    return Confirm.Check(DataBase.Update());
                }
            }
            catch
            {
                return Confirm.Check(false);
            }
        }
Пример #43
0
        public bool Add_Update()
        {
            try
            {

                DB DataBase = new DB("outcome_types");

                DataBase.AddColumn("ott_name", Name_TB.Text);

                if (this.TypeId == null)
                {
                    if (DataBase.IsNotExist("ott_id", "ott_name"))
                    {
                        return Confirm.Check(DataBase.Insert());
                    }
                    else
                    {
                        Message.Show("لقد تم تسجيل نوع المصروف من قبل", MessageBoxButton.OK, 5);
                        return false;
                    }


                }
                else
                {
                    DataBase.AddCondition("ott_id", this.TypeId);
                    return Confirm.Check(DataBase.Update());
                }
            }
            catch
            {
                //MessageBox.Show("kiki_method");
                return false;
            }
        }
    protected void Button1_Click(object sender, EventArgs e)
    {
        DB db = new DB();
        //String time = period_star.Year + "年" + period_star.Month + "月" + period_star.Day + "日";
        //赋值
        if (Button1.Text == "提交")//插入操作
        {
            if (this.TextBox1.Text == "")
            {
                Response.Write("<script>alert('论文小结不能为空!');</script>");
                return;
            }
            //查找是否存在于表中如果存在则相当已修改,不存在为插入
            String insert = "insert into aimCom(student_ID,student_Name,Depart,class,teacher_Name,time,title,AimComplete,Year,teacher_ID) values('" +

Label1.Text + "','" + Label2.Text + "','" + Label3.Text + "','" + Label4.Text + "','" + Label5.Text + "','" +

Label6.Text + "','" + Label7.Text + "','" + this.TextBox1.Text + "','" + Session["year"] + "','" + Session["teacher_ID"] + "') ";
           
            if (db.Insert(insert, db.DBconn()))
            {
                Response.Write("<script>alert('毕业论文小结填写成功。');location='summarization.aspx'</script>");
            }
            else
            {
                Response.Write("<script>alert('毕业论文小结填写失败。');location='summarization.aspx'</script>");
            }

        }
        else//更新操作
        {
            String update = "update aimCom set AimComplete='" + this.TextBox1.Text + "' where student_ID='" + Session["username"] + "'";

            if (db.Update(update, db.DBconn()))
            {
                Response.Write("<script>alert('毕业论文小结修改成功。');location='summarization.aspx'</script>");
            }
            else
            {
                Response.Write("<script>alert('毕业论文小结修改失败。');location='summarization.aspx'</script>");
            }

        }

    }
        private bool Add_Update()
        {
            try
            {

                DB DataBase = new DB("attendence");

                DataBase.AddColumn("att_emp_id", Employees_CB.SelectedValue);
                DataBase.AddColumn("att_date", Date_DTP.Value.Value.Date);
                DataBase.AddColumn("att_attend", Attend_DTP.Value.Value.TimeOfDay);
                DataBase.AddColumn("att_leave", null);
                DataBase.AddColumn("att_time", null);
                if(Leave_DTP.Value != null)
                {
                    DataBase.Columns_Values[3].Value = Leave_DTP.Value.Value.TimeOfDay;
                    DataBase.Columns_Values[4].Value = Attend_DTP.Value.Value.TimeOfDay <= Leave_DTP.Value.Value.TimeOfDay ?
                                                       Leave_DTP.Value.Value.TimeOfDay - Attend_DTP.Value.Value.TimeOfDay :
                                                       Leave_DTP.Value.Value.TimeOfDay.Add(new TimeSpan(24, 0, 0)) - Attend_DTP.Value.Value.TimeOfDay;
                }
                if(Attendence_Id == null)
                {
                    if(DataBase.IsNotExist("att_id", "att_emp_id", "att_date"))
                    {
                        return DataBase.Insert();
                    }
                    else
                    {
                        Message.Show("هذا الاسم مستخدم من قبل", MessageBoxButton.OK, 5);
                        return false;
                    }
                }
                else
                {
                    DataBase.AddCondition("att_Id", this.Attendence_Id);
                    return DataBase.Update();
                }

            }
            catch
            {
                return false;
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["username"] == null)
        {
            Response.Write("<script>alert('用户登录超时,请重新登录。');location='../Default.aspx'</script>");
            return;
        }

            
            DB db = new DB();
            String time = "select * from time where period='学生选课'";
            DataSet ds = db.Select(time, db.DBconn());
            try
            {

                DateTime period_star1 = Convert.ToDateTime(ds.Tables[0].Rows[0][2].ToString()); //开始时间
                DateTime period_end1 = Convert.ToDateTime(ds.Tables[0].Rows[0][3].ToString());//结束时间
                String flg = ds.Tables[0].Rows[0][5].ToString(); ;//结束时间
                ds.Clear();
                DateTime now = DateTime.Today;

                if (flg == "开" && (now >= period_star1) && (now <= period_end1))
                {
                }
                else
                {
                    this.Button3.Visible = false;
                }
            }
            catch
            {
                Response.Write("<script>alert('数据库时间设定取出过程错误,您可能还未设定时间。');location='Default.aspx'</script>");
            }



        //获取数据
  
            Session["paperid"] = Request.QueryString["paperid"].ToString();
            string paperid = Request.QueryString["paperid"].ToString();
            string tag = "";
            string priority = "";
            try
            {
                tag = Request.QueryString["tag"].ToString();
                priority = Request.QueryString["priority"].ToString();
            }
            catch
            {
            }
      
 //查题*************************************** 
        String sel = "select * from paperApply where id='" + Request.QueryString["paperid"].ToString() + "'";
         ds = db.Select(sel, db.DBconn());
            try
            {  
               
            
                this.Label1.Text = ds.Tables[0].Rows[0][3].ToString();
                Label3.Text = ds.Tables[0].Rows[0][2].ToString();
                Label4.Text = ds.Tables[0].Rows[0][4].ToString();
                Label5.Text = ds.Tables[0].Rows[0][5].ToString();
                Label6.Text = ds.Tables[0].Rows[0][6].ToString();
                Label7.Text = ds.Tables[0].Rows[0][7].ToString();
                String teacher_Name = Convert.ToString(ds.Tables[0].Rows[0][20].ToString());
                Label8.Text = " 教工号:" + Request.QueryString["teacher_ID"] + " 教师姓名:" + teacher_Name;
                this.TextBox1.Text = ds.Tables[0].Rows[0][8].ToString(); ;
                this.TextBox2.Text = ds.Tables[0].Rows[0][9].ToString(); ;
                this.TextBox3.Text = ds.Tables[0].Rows[0][10].ToString();
                this.TextBox4.Text = ds.Tables[0].Rows[0][11].ToString();
                this.TextBox5.Text = ds.Tables[0].Rows[0][12].ToString();
                this.TextBox6.Text = ds.Tables[0].Rows[0][13].ToString();
                int first_select = Convert.ToInt32(ds.Tables[0].Rows[0][17].ToString());
                int second_select = Convert.ToInt32(ds.Tables[0].Rows[0][18].ToString());
                int third_select = Convert.ToInt32(ds.Tables[0].Rows[0][19].ToString());
                this.Label2.Text = "该课题选择情况:第一志愿" + first_select + "人,第二志愿" + second_select + "人,第三志愿" + third_select + "人。";    
                if (tag.Equals("1"))//删除操作
                {
                    string update = "";//初始化更新语句
                    if (priority.Equals("1"))//第一志愿
                    {
                        first_select = Convert.ToInt32(ds.Tables[0].Rows[0][17].ToString());
                        first_select--;
                        update = "update paperApply set first_select='" + first_select + "' where id='" + paperid + "'";//更新选题情况信息
                       
                    }
                    if (priority.Equals("2"))//第二志愿
                    {
                         second_select = Convert.ToInt32(ds.Tables[0].Rows[0][18].ToString());
                        second_select--;
                         update = "update paperApply set second_select='" + second_select + "' where id='" + paperid + "'";//更新选题情况信息
                    }
                    if (priority.Equals("3"))//第三志愿
                    {
                        third_select = Convert.ToInt32(ds.Tables[0].Rows[0][19].ToString());
                        third_select--;
                        update = "update paperApply set first_select='" + third_select + "' where id='" + paperid + "'";//更新选题情况信息
                    }
                     string del="delete from themeSelectedResult where student_ID='"+Session["username"]+"'and priority='"+priority+"'";

                     if (db.Update(update, db.DBconn()) && db.Delete(del, db.DBconn()))
                        
                    {
                            Response.Write("<script>alert('您的课题第" + priority + "志愿删除成功');location='studentSelect.aspx'</script>");
                       
                    }
  
                    else  
                    {
                        Response.Write("<script>alert('您的课题第" + priority + "志愿删除失败');location='studentSelect.aspx'</script>");   
                    }     

                }
               
              
            }
            catch
            {
                Response.Write("<script>alert('数据库出错。');location='studentSelect.aspx'</script>");
            }
            finally
            {
                ds.Clear();
            }

         //判断选题次数\
        String  sel1="select * from themeSelectedResult where student_ID='"+Session["username"]+"'";
        ds = db.Select(sel1, db.DBconn());

        if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 3)
        {
                Button3.Enabled = false;
                Response.Write("<script>alert('你已经选择三个志愿了,不可以再提交。');location='studentSelect.aspx'</script>");
        }  
    }
    protected void Button3_Click(object sender, EventArgs e)
    {     
        
        DB db = new DB();
        SqlConnection conn = db.DBconn();
        DateTime now = DateTime.Today; 

        //获取教师信息

        string teacher_ID=Session["teacher_ID"].ToString();
     
        string title=this.Label1.Text;
        string teacher_Name = Session["teacher_Name"].ToString();

        //获取领导信息
        string lead_ID = Session["username"].ToString();
        string lead_Name = Session["name"].ToString();
        //获取文本信息
        String state=this.RadioButtonList1.SelectedValue;
        String content=this.TextBox7.Text;
        if (content == "")
        {
            Response.Write("<script>alert('审批内容不能为空!');</script>");
            return;
        }
        string insert = "insert into TtoLContent(teacher_ID,lead_ID,title,time,state,content,teacher_Name,lead_Name,role,paperid) values('" + teacher_ID + "','" + lead_ID + "','" + title + "','" + now + "','" + state + "','" + content + "','" + teacher_Name + "','" + lead_Name + "','" + Session["role"] + "','" + Session["paperid"] + "')";

        String update = "update paperApply set state1='" + state + "' where teacher_ID='" + teacher_ID + "'and title='" + title + "'";
       // db.Update(update, conn);
        if (db.Insert(insert, conn) && db.Update(update, conn))
        {
            Response.Write("<script>alert('审核成功!');location='departExamine.aspx'</script>");
        }
        else
        {
            Response.Write("<script>alert('审核失败!');location='departExamine.aspx'</script>");

        }
    }
Пример #48
0
        public bool Add_Update()
        {
            try
            {

                DB DataBase = new DB("payments");
                //DataBase.AddColumn("trs_no", No_TB.Text.Trim());
                DataBase.AddColumn("pay_trn_id", Payment_type);
                DataBase.AddColumn("pay_per_id", Person_CB.SelectedValue);
                DataBase.AddColumn("pay_date", Date_DTP.Value.Value.Date);
                DataBase.AddColumn("pay_value", Value_TB.Text.Trim());

                if(this.Payment_Id == null)
                {
                    if (DataBase.IsNotExist("pay_id", "pay_per_id", "pay_trn_id", "pay_date", "pay_value"))
                    {
                        return Confirm.Check(DataBase.Insert());
                    }
                    else
                    {
                        // ye3ny hwa mawgood asln mesh ha3ml 7aga 
                        Message.Show("هذا المستند موجود من قبل", MessageBoxButton.OK, 5);
                        return false;
                        //DataBase.AddCondition("pl_id", this.placeId);
                        //DataBase.Update();

                    }


                }

// hena ye3ny hwa mawgod ba3mel edit
                else
                {
                    DataBase.AddCondition("pay_id", this.Payment_Id);
                    return Confirm.Check(DataBase.Update());
                }
            }
            catch
            {
                return Confirm.Check(false);
            }
        }