protected void BtnSubmit_Click(object sender, EventArgs e)
    {
        if (Txtname.Text.Trim() == "") Response.Write("<script>alert('姓名不能为空')</script>");
        else if (TxtMail.Text.Trim() == "") Response.Write("<script>alert('邮箱不能为空')</script>");
        else if (TxtGrade.Text.Trim() == "") Response.Write("<script>alert('入学年份不能为空')</script>");
        else if (TxtPhone.Text.Trim() == "") Response.Write("<script>alert('国籍不能为空')</script>");
        else if (TxtBirth.Text.Trim() == "") Response.Write("<script>alert('出生年月不能为空')</script>");
        else if (TxtHome.Text.Trim() == "") Response.Write("<script>alert('毕业院校不能为空')</script>");
        else if (TxtMajor.Text.Trim() == "") Response.Write("<script>alert('专业不能为空')</script>");
        else
            using (var db = new CstwebEntities())
            {
                try
                {
                    if (teaid == 0)
                    {
                        var tea = new exchange();
                        tea.name = Txtname.Text.Trim();
                        tea.email = TxtMail.Text.Trim();
                        tea.photo = ImgIco.ImageUrl.ToString();
                        tea.major = TxtMajor.Text.Trim();
                        tea.home = TxtHome.Text.Trim();
                        tea.birth = TxtBirth.Text.Trim();
                        tea.grade = TxtGrade.Text.Trim();
                        tea.nation = TxtPhone.Text.Trim();
                        string tempstr = Server.HtmlDecode(myEditor.InnerHtml);
                        if (tempstr != "") tea.ect = tempstr;
                        db.exchange.Add(tea);
                        db.SaveChanges();
                        
                        Response.Write("<script language=javascript>alert('添加成功');window.location = 'exchangelist.aspx';</script>");

                    }
                    else
                    {
                        exchange tea = db.exchange.First<exchange>(a => a.id == teaid);
                        tea.name = Txtname.Text.Trim();
                        tea.email = TxtMail.Text.Trim();
                        tea.photo = ImgIco.ImageUrl.ToString();
                        tea.major = TxtMajor.Text.Trim();
                        tea.home = TxtHome.Text.Trim();
                        tea.birth = TxtBirth.Text.Trim();
                        tea.grade = TxtGrade.Text.Trim();
                        tea.nation = TxtPhone.Text.Trim();
                        string tempstr = Server.HtmlDecode(myEditor.InnerHtml);
                        if (tempstr != "") tea.ect = tempstr;

                        db.SaveChanges();
                        Response.Write("<script language=javascript>alert('修改成功');window.location = 'exchangelist.aspx';</script>");
                    }


                }
                catch
                {
                    Response.Write("<script>alert('失败')</script>");
                }

            }
    }
        public ActionResult Create(ExchangeModels e)
        {
            //if (!ModelState.IsValid)
            //{
            //     RedirectToAction("Create");
            // }
            Boolean verif  = ce.verif(e.idgooddemande, e.idgoodOffre);
            Boolean verif2 = ce.verif(e.idgoodOffre, e.idgooddemande);

            if (!ModelState.IsValid)
            {
                //ModelState.AddModelError("CustomError", "The Same test Type might have been already created,, go back to the Visit page to see the avilalbe Lab Tests");
                e.offres = ca.ConsultGoods2(1).ToSelectListItems();
                return(View(e));
            }

            else if (verif2 == true)
            {
                ModelState.AddModelError("CustomError", "The Same exchange request might have been already created with this product");
                e.offres = ca.ConsultGoods2(1).ToSelectListItems();
                return(View(e));
            }

            else if (verif == true)
            {
                ModelState.AddModelError("CustomError", "The Same exchange request might have been already created by the owner of the product you desire,, go back to your exchange section and verify it's presence");
                e.offres = ca.ConsultGoods2(1).ToSelectListItems();
                return(View(e));
            }

            else
            {
                exchange ech = new exchange
                {
                    date_exchange = e.date_exchange,
                    idgooddemande = e.idgooddemande,
                    status        = 0,
                    idgoodOffre   = e.idgoodOffre,
                    id_exchange   = e.id_exchange,
                };



                ce.Add(ech);
                ce.Commit();



                // return Content("Item not found");
                // ModelState.AddModelError("", "votre compte est verouiller.");
                // RedirectToAction("Create", new { id = e.idgooddemande });
                // RedirectToAction("IndexPersonnel");
            }
            return(RedirectToAction("Index"));
        }
        public ActionResult CancelEchange(int id)
        {
            //if (!ModelState.IsValid)
            //{
            //     RedirectToAction("Create");
            // }
            exchange ech = ce.GetById(id);

            // exchange ech = ce.EchangeDetails(id);
            ech.status = Domain.Entities.Statusexchange.canceled;

            ce.Update(ech);
            ce.Commit();
            return(RedirectToAction("IndexPersonnel"));
        }
Beispiel #4
0
    protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "del")
        {
            using (var db = new CstwebEntities())
            {
                int      id  = Convert.ToInt32(e.CommandArgument);
                exchange tea = db.exchange.FirstOrDefault(a => a.id == id);

                db.exchange.Remove(tea);

                db.SaveChanges();
                Response.Write("<script>alert('删除成功');window.location = 'exchangelist.aspx';</script>");
            }
        }
    }
        private void AddClashClick(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Multiselect = true;
            dialog.Filter      = "Navisworks report (*.xml)|*.xml";

            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                foreach (string filePath in dialog.FileNames)
                {
                    _report = ReadReport(filePath);
                    FillClashTestList(filePath);
                }
            }
        }
Beispiel #6
0
        public ActionResult Edit([Bind(Include = "numCoupon,couponValue,dateLimite,users_id,state")] exchange exchange)
        {
            //user id get it from session
            var postTask = httpClient.PutAsJsonAsync <exchange>(baseAddress + "ConsomiTounsi/Exchange/updateExchange/" + u.id, exchange);

            postTask.Wait();

            var result = postTask.Result;

            if (result.IsSuccessStatusCode)
            {
                return(RedirectToAction("Index"));
            }

            return(View(exchange));
        }
        private exchange ReadReport(string filePath)
        {
            exchange reportRoot = new exchange();

            using (Stream objStream = new FileStream(filePath, FileMode.Open))
            {
                XmlSerializer serializer = new XmlSerializer(typeof(exchange));

                StreamReader sr = new StreamReader(objStream);

                XmlReaderSettings settings = new XmlReaderSettings();
                settings.IgnoreComments = true;


                using (XmlReader reader = XmlReader.Create(sr, settings))
                {
                    reportRoot          = (exchange)serializer.Deserialize(reader);
                    reportRoot.filename = filePath;
                    reportRoot.filepath = Path.GetDirectoryName(filePath);
                }
            }

            return(reportRoot);
        }
Beispiel #8
0
 var(exchange, queue, autoStartListener, consumerTag, consumerCount) = properties(context);
Beispiel #9
0
        private void obmen_btn_Click(object sender, RoutedEventArgs e)
        {
            exchange ex = new exchange();

            ex.ShowDialog();
        }
    protected void BtnSubmit_Click(object sender, EventArgs e)
    {
        if (Txtname.Text.Trim() == "")
        {
            Response.Write("<script>alert('姓名不能为空')</script>");
        }
        else if (TxtMail.Text.Trim() == "")
        {
            Response.Write("<script>alert('邮箱不能为空')</script>");
        }
        else if (TxtGrade.Text.Trim() == "")
        {
            Response.Write("<script>alert('入学年份不能为空')</script>");
        }
        else if (TxtPhone.Text.Trim() == "")
        {
            Response.Write("<script>alert('国籍不能为空')</script>");
        }
        else if (TxtBirth.Text.Trim() == "")
        {
            Response.Write("<script>alert('出生年月不能为空')</script>");
        }
        else if (TxtHome.Text.Trim() == "")
        {
            Response.Write("<script>alert('毕业院校不能为空')</script>");
        }
        else if (TxtMajor.Text.Trim() == "")
        {
            Response.Write("<script>alert('专业不能为空')</script>");
        }
        else
        {
            using (var db = new CstwebEntities())
            {
                try
                {
                    if (teaid == 0)
                    {
                        var tea = new exchange();
                        tea.name   = Txtname.Text.Trim();
                        tea.email  = TxtMail.Text.Trim();
                        tea.photo  = ImgIco.ImageUrl.ToString();
                        tea.major  = TxtMajor.Text.Trim();
                        tea.home   = TxtHome.Text.Trim();
                        tea.birth  = TxtBirth.Text.Trim();
                        tea.grade  = TxtGrade.Text.Trim();
                        tea.nation = TxtPhone.Text.Trim();
                        string tempstr = Server.HtmlDecode(myEditor.InnerHtml);
                        if (tempstr != "")
                        {
                            tea.ect = tempstr;
                        }
                        db.exchange.Add(tea);
                        db.SaveChanges();

                        Response.Write("<script language=javascript>alert('添加成功');window.location = 'exchangelist.aspx';</script>");
                    }
                    else
                    {
                        exchange tea = db.exchange.First <exchange>(a => a.id == teaid);
                        tea.name   = Txtname.Text.Trim();
                        tea.email  = TxtMail.Text.Trim();
                        tea.photo  = ImgIco.ImageUrl.ToString();
                        tea.major  = TxtMajor.Text.Trim();
                        tea.home   = TxtHome.Text.Trim();
                        tea.birth  = TxtBirth.Text.Trim();
                        tea.grade  = TxtGrade.Text.Trim();
                        tea.nation = TxtPhone.Text.Trim();
                        string tempstr = Server.HtmlDecode(myEditor.InnerHtml);
                        if (tempstr != "")
                        {
                            tea.ect = tempstr;
                        }

                        db.SaveChanges();
                        Response.Write("<script language=javascript>alert('修改成功');window.location = 'exchangelist.aspx';</script>");
                    }
                }
                catch
                {
                    Response.Write("<script>alert('失败')</script>");
                }
            }
        }
    }