protected void dvControl_ItemInserting(object sender, DetailsViewInsertEventArgs e)
 {
     if (!this.Validate())
     {
         e.Cancel = true;
     }
 }
Example #2
0
        protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
        {
            FileUpload file = (FileUpload)DetailsView1.FindControl("FileUpload2");

            if (file.HasFile)
            {
                string filename = file.FileName;
                string path     = Server.MapPath("~/img/") + filename;
                file.SaveAs(path);
                SqlDataSource1.InsertParameters["Epic"].DefaultValue = "~/img/" + filename;
                //连接数据库
                String        cnstr = @"Data Source=(LocalDB)\MSSQLLocalDB;" + "AttachDbFilename=|DataDirectory|Database1.mdf;" + "Integrated Security=True";
                SqlConnection conn  = new SqlConnection(cnstr);
                //打开数据库连接
                conn.Open();
                //传入sql语句
                String sql = "insert into Equipment(Eid,Ename,Esize,Epic,Eprice,Edate,Eplace,manager)" +
                             "values('" + SqlDataSource1.InsertParameters["Eid"].DefaultValue + "','" + SqlDataSource1.InsertParameters["Ename"].DefaultValue + "','" + SqlDataSource1.InsertParameters["Esize"].DefaultValue + "'," +
                             "'" + SqlDataSource1.InsertParameters["Epic"].DefaultValue + "','" + SqlDataSource1.InsertParameters["Eprice"].DefaultValue + "','" + SqlDataSource1.InsertParameters["Edate"].DefaultValue + "'," +
                             "'" + SqlDataSource1.InsertParameters["Eplace"].DefaultValue + "','" + SqlDataSource1.InsertParameters["manager"].DefaultValue + "')";
                SqlCommand cmd = new SqlCommand(sql, conn);
                conn.Close();
            }
            else
            {
                SqlDataSource1.UpdateParameters["Eid"].DefaultValue = "";
            }
        }
    protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        string name = ((TextBox)DetailsView1.FindControl("txtName")).Text;
        string image;

        if (((FileUpload)DetailsView1.FindControl("fuImage")).HasFile)
        {
            image = ((FileUpload)DetailsView1.FindControl("fuImage")).FileName.ToString();
            ((FileUpload)DetailsView1.FindControl("fuImage")).SaveAs((Server.MapPath("Images/ProductImages/") + ((FileUpload)DetailsView1.FindControl("fuImage")).FileName));
        }
        else
        {
            image = "NULL";
        }
        double price       = Convert.ToDouble(((TextBox)DetailsView1.FindControl("txtPrice")).Text);
        string description = ((TextBox)DetailsView1.FindControl("txtDescription")).Text;
        int    idcat       = Convert.ToInt32(((DropDownList)DetailsView1.FindControl("ddlCat")).SelectedIndex + 1);
        int    idroom      = Convert.ToInt32(((DropDownList)DetailsView1.FindControl("ddlRoom")).SelectedIndex + 1);
        int    inventory   = Convert.ToInt32(((TextBox)DetailsView1.FindControl("txtInventory")).Text);
        bool   featured    = Convert.ToBoolean(((CheckBox)DetailsView1.FindControl("cbFeaturedEdit")).Checked);
        bool   taxable     = Convert.ToBoolean(((CheckBox)DetailsView1.FindControl("cbTaxableEdit")).Checked);

        DetailsView1.DataBind();
        string query = "INSERT INTO PRODUCTS (NAME, IMAGE, PRICE, DESCRIPTION, IDCAT, IDROOM, FEATURED, TAXABLE, INVENTORY) values (@name, @image, @price, @description, @idcat, @idroom, @featured, @taxable, @inventory)";

        using (SqlConnection cnn = new SqlConnection(myConnectionString))
        {
            using (SqlCommand cmd = new SqlCommand())
            {
                cmd.Connection  = cnn;
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = query;
                cmd.Parameters.AddWithValue("@name", name);
                cmd.Parameters.AddWithValue("@image", image);
                cmd.Parameters.AddWithValue("@price", price);
                cmd.Parameters.AddWithValue("@description", description);
                cmd.Parameters.AddWithValue("@idcat", idcat);
                cmd.Parameters.AddWithValue("@idroom", idroom);
                cmd.Parameters.AddWithValue("@featured", featured);
                cmd.Parameters.AddWithValue("@taxable", taxable);
                cmd.Parameters.AddWithValue("@inventory", inventory);
                try
                {
                    cnn.Open();
                    cmd.ExecuteNonQuery();
                    Response.Write("<script language='javascript'>alert('Product added to the Database.');</script>");
                }
                catch (SqlException ex)
                {
                    //Response.Write("<script language='javascript'>alert('Error has occured.');</script>");
                    System.Diagnostics.Debug.WriteLine(ex.Message);
                }
                finally
                {
                    cnn.Close();
                    UpdateGridView();
                }
            }
        }
    }
Example #4
0
    protected void OwnerDetailsView_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        DetailsView  ClientDetailsView = (DetailsView)sender;
        DropDownList ddlClientTypes    = (DropDownList)ClientDetailsView.FindControl("ddlClientTypes");

        if (ddlClientTypes.SelectedValue == "Private")
        {
            e.Values["IsLaw"]       = false;
            e.Values["IsForeigner"] = false;
        }
        if (ddlClientTypes.SelectedValue == "Law")
        {
            e.Values["IsLaw"]       = true;
            e.Values["IsForeigner"] = false;
        }
        if (ddlClientTypes.SelectedValue == "ForeignPrivate")
        {
            e.Values["IsLaw"]       = false;
            e.Values["IsForeigner"] = true;
        }
        if (ddlClientTypes.SelectedValue == "ForeignLaw")
        {
            e.Values["IsLaw"]       = true;
            e.Values["IsForeigner"] = true;
        }
    }
        protected void DetailsView2_ItemInserting(object sender, DetailsViewInsertEventArgs e)
        {
            XmlDocument xdoc = XmlDataSource4.GetXmlDocument();

            XmlElement FeedsList = xdoc.SelectSingleNode("/feeds") as XmlElement;
            XmlElement checkFeed = xdoc.SelectSingleNode("/feeds/feed[@name='" + e.Values["name"].ToString() + "']") as XmlElement;

            if (checkFeed == null)
            {
                XmlElement oFeed = xdoc.CreateElement("feed");

                XmlAttribute name = xdoc.CreateAttribute("name");
                XmlAttribute url  = xdoc.CreateAttribute("url");

                name.Value = e.Values["name"].ToString();
                url.Value  = e.Values["url"].ToString();

                oFeed.Attributes.Append(name);
                oFeed.Attributes.Append(url);

                FeedsList.AppendChild(oFeed);
                XmlDataSource4.Save();
                e.Cancel = true;
            }

            Response.Redirect(Request.RawUrl);
        }
 protected void UploadPhotoDetailsView_ItemInserting(object sender, DetailsViewInsertEventArgs e)
 {
     byte[] imageFile = e.Values["UploadBytes"] as byte[];
     if ((imageFile == null) || (imageFile.Length == 0))
     {
         e.Cancel = true;
         this.UploadErrorMessage.Visible = false;
     }
     else
     {
         try
         {
             byte[] fullImage   = ProductPhotos.ResizeImageFile(imageFile, SueetiePhotoSize.Full);
             byte[] mediumImage = ProductPhotos.ResizeImageFile(imageFile, SueetiePhotoSize.Medium);
             byte[] smallImage  = ProductPhotos.ResizeImageFile(imageFile, SueetiePhotoSize.Small);
             e.Values.Add("bytesFull", fullImage);
             e.Values.Add("bytesMedium", mediumImage);
             e.Values.Add("bytesSmall", smallImage);
             e.Values.Remove("UploadBytes");
             bool flag = this.PhotoGridView.Rows.Count == 0;
             e.Values.Add("useAsPreview", flag);
             this.UploadErrorMessage.Visible = false;
         }
         catch
         {
             e.Cancel = true;
             this.UploadErrorMessage.Visible = true;
             throw;
         }
     }
 }
Example #7
0
 // ==============================
 // === Insert ===================
 protected void mfDataCollector_ItemInserting(object sender, DetailsViewInsertEventArgs e)
 {
     Bll.DataRule.Extend UpdateRule = CreateRule(e.Values);
     Bll.DataRule.InsertOrUpdate(UpdateRule);
     e.Cancel = true;
     RedirectToGrid();
 }
 protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
 {
     if (!UploadFile(false))
     {
         e.Cancel = true;
     }
 }
Example #9
0
        protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
        {
            CheckBox chb = (CheckBox)DetailsView1.FindControl("Man");

            e.Values["TSex"] = chb.Checked ? "男" : "女";
            e.Values["TPwd"] = Common.Getmd5("123");
        }
Example #10
0
    protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        e.Values.Add("CreatedOn", Convert.ToString(DateTime.Now));
        e.Values.Add("IsDeleted", false);

        e.Values.Add("UserName", System.Web.Security.Membership.GetUser().UserName);
    }
Example #11
0
    protected void dvProposal_OnItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        string proposalCode  = e.Values[1].ToString();
        string proposalTitle = e.Values[2].ToString();
        string yearSubmitted = e.Values[3].ToString();

        //give me a NullReferenceException. Cannot find the DropDownList control in the DetailView.
        string proposalStatus = ((DropDownList)dvProposal.Rows[4].Cells[1].FindControl("ddlProposalStatus")).SelectedValue;

        string proposalLink = e.Values[4].ToString();

        string insertString = " insert into Proposal (ProposalCode, ProposalTitle, YearSubmitted, ProposalStatus, ProposalLink) " +
                              "values('" + proposalCode + "','" + proposalTitle + "'," + yearSubmitted + ",'" + proposalStatus + "','" + proposalLink + "')";


        OleDbConnection MyConnection = new OleDbConnection(connectionString);
        OleDbCommand    MyCommand    = new OleDbCommand(insertString, MyConnection);

        MyConnection.Open();

        MyCommand.ExecuteNonQuery();



        MyConnection.Close();

        dvProposal_DataRebind();
    }
        protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
        {
            try
            {
                var    fileUpload = (FileUpload)DetailsView1.FindControl("FileUpload2");
                string fileToSave = String.Empty;

                if (fileUpload.HasFile == true)
                {
                    fileToSave = Server.MapPath("~/Image/" + fileUpload.FileName);
                    fileUpload.SaveAs(fileToSave);
                }
                else
                {
                    return;
                }


                SqlDataSource4.InsertParameters["ImageFile"].DefaultValue = "~/Image/" + fileUpload.FileName;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #13
0
 protected void dvPessoaSocio_ItemInserting(object sender, DetailsViewInsertEventArgs e)
 {
     if (Request.QueryString["idPessoa"] != null && Request.QueryString["idPessoa"].Trim() != String.Empty)
     {
         e.Values["idPessoa"] = Convert.ToInt32(Request.QueryString["idPessoa"]);
     }
 }
Example #14
0
    protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        TextBox role = DetailsView1.FindControl("TextBox1") as TextBox;

        if (role != null)
            e.Values.Add("role", role.Text);
    }
        protected void dvProcessoPrazo_ItemInserting(object sender, DetailsViewInsertEventArgs e)
        {
            //string idPessoa = ((HiddenField)((DetailsView)sender).FindControl("hdIdPessoaAdvogado")).Value;
            //if (idPessoa.Trim() != String.Empty)
            //    e.Values["idPessoaAdvogadoResponsavel"] = idPessoa;

            string idProcesso = ((HiddenField)((DetailsView)sender).FindControl("hdIdProcesso")).Value;

            if (idProcesso.Trim() != String.Empty)
            {
                e.Values["idProcesso"] = idProcesso;
            }

            e.Values["idUsuarioCadastro"] = DataAccess.Sessions.IdUsuarioLogado;

            //if (Request.QueryString["IdProcesso"] != null && Request.QueryString["IdProcesso"].Trim() != String.Empty)
            //    e.Values["idProcesso"] = Convert.ToInt32(Request.QueryString["IdProcesso"]);

            // DESATIVADO POR SOLICITAÇÃO DA EPC, PREFEREM DEIXAR MANUAL
            //if (e.Values["idTipoPrazo"] != null
            //    && e.Values["idTipoPrazo"].ToString() != String.Empty)
            //{
            //    int quantidadeDiasPrazo = bllTipoPrazoProcessual.Get(Convert.ToInt32(e.Values["idTipoPrazo"].ToString())).quantidadeDiasPrazo;

            //    if (e.Values["dataPublicacao"] != null
            //        && e.Values["dataPublicacao"].ToString() != String.Empty)
            //    {
            //        DateTime dataVencimento = Convert.ToDateTime(e.Values["dataPublicacao"].ToString()).AddDays(quantidadeDiasPrazo);
            //        e.Values["dataVencimento"] = dataVencimento;
            //    }
            //}
        }
Example #16
0
        protected void DetailsView3_ItemInserting(object sender, DetailsViewInsertEventArgs e)      //course 插入判断
        {
            CourseManager  course = new CourseManager();
            TeacherManager t      = new TeacherManager();

            if (e.Values["num"] == null || e.Values["teacher"] == null || e.Values["name"] == null)
            {
                ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "msg1", "alert('插入失败!course表中num,teacher,name字段都不能为空');", true);
                e.Cancel = true;
                return;
            }
            if (course.GetCourseByNum(e.Values["num"].ToString()) != null)
            {
                ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "msg1", "alert('插入失败!course表中num已存在');", true);
                e.Cancel = true;
                return;
            }

            if (t.GetTeacher(e.Values["teacher"].ToString()) == null)
            {
                ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "msg1", "alert('插入失败!course表中外键teacher不存在');", true);
                e.Cancel = true;
                return;
            }
        }
    protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["fccl2ConnectionString"].ConnectionString);
        SqlCommand cmd = new SqlCommand();
        cmd.Connection = cnn;
        string crot = e.Values["Crotalia"].ToString();
        if (crot.Trim().Length == 0)
        {
            Label2.Text = "Crotalia este camp obligatoriu !";
            e.Cancel = true;
            return;
        }

        cmd.CommandText = "SELECT * from Crotalii WHERE Crotalia ='"
        + crot + "'";
        cnn.Open();
        SqlDataReader reader = cmd.ExecuteReader();
        if (reader.Read())
        {
            Label2.Text = "Crotalia " + crot + " exista deja!";
            e.Cancel = true;
        }
        else
            Label2.Text = "";

        reader.Close();
        cnn.Close();
        
    }
 protected void dvMovieAddress_ItemInserting(object sender, DetailsViewInsertEventArgs e)
 {
     e.Values["AddTime"] = DateTime.Now;
     //e.Values["MovieTime"] = TimeSpan.FromMinutes(Convert.ToDouble(e.Values["MovieTime"]));
     e.Values["DownCount"]  = 0;
     e.Values["WatchCount"] = 0;
 }
        protected void ActivitiesDetailsView_ItemInserting(object sender, DetailsViewInsertEventArgs e)
        {
            UserLogCategory userLogCategory = new UserLogCategory();

            if (e.Values["UserLogCategoryCode"] == null)
            {
                userLogCategory.IsDisplayed                = false;
                userLogCategory.IsSyndicated               = false;
                userLogCategory.UserLogCategoryCode        = "Error";
                userLogCategory.UserLogCategoryDescription = "Bad entry.  All fields are required. Delete and re-enter.";
                userLogCategory.UserLogCategoryID          = -1;
            }
            else
            {
                userLogCategory.IsDisplayed                = bool.Parse(e.Values["IsDisplayed"].ToString());
                userLogCategory.IsSyndicated               = bool.Parse(e.Values["IsSyndicated"].ToString());
                userLogCategory.UserLogCategoryCode        = e.Values["UserLogCategoryCode"] as string;
                userLogCategory.UserLogCategoryDescription = e.Values["UserLogCategoryDescription"] as string;
                userLogCategory.UserLogCategoryID          = int.Parse(e.Values["UserLogCategoryID"] as string);
            }

            e.Values["catCode"] = userLogCategory.UserLogCategoryCode;
            e.Values["catDesc"] = userLogCategory.UserLogCategoryDescription;
            e.Values.Add("isDisplayed", userLogCategory.IsDisplayed);
            e.Values.Add("isSyndicated", userLogCategory.IsSyndicated);
            e.Values.Add("catID", userLogCategory.UserLogCategoryID);
            e.Values.Remove("UserLogCategoryID");
            e.Values.Remove("UserLogCategoryCode");
            e.Values.Remove("UserLogCategoryDescription");
        }
    protected void DetailsView2_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        var project = PopulateProject();

        if (project.Latitude == null || project.Longitude == null)
        {
            return;
        }

        if (!projectBLL.ValidateProjectCode(project.Id, project.Code))
        {
            lblSaveError.Text    = "* Your chosen project code already exists, please choose another.";
            lblSaveError.Visible = true;
            return;
        }

        var message = projectBLL.AddOrUpdateProject(project);

        if (string.IsNullOrWhiteSpace(message))
        {
            RedirectToMap();
        }
        else
        {
            lblSaveError.Text    = "* " + message;
            lblSaveError.Visible = true;
        }
    }
    protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["fccl2ConnectionString"].ConnectionString);
        SqlCommand    cmd = new SqlCommand();

        cmd.Connection = cnn;
        string cod = e.Values["CodPrelevator"].ToString();


        cmd.CommandText = "SELECT * from Prelevatori WHERE CodPrelevator ='" + cod + "'";
        cnn.Open();
        SqlDataReader reader = cmd.ExecuteReader();

        if (reader.Read())
        {
            Label2.Text = "Codul " + cod + " exista deja!";
            e.Cancel    = true;
        }
        else
        {
            Label2.Text = "";
        }

        reader.Close();
        cnn.Close();
    }
        protected void DetailsView2_ItemInserting(object sender, DetailsViewInsertEventArgs e)
        {
            String strPet;
            int    petID;

            strPet = String.Empty;

            if (rbDog.Checked)
            {
                strPet = "Dog";
            }

            if (rbCat.Checked)
            {
                strPet = "Cat";
            }

            if (strPet == String.Empty)
            {
                Response.Write("<script>alert('You must check Dog or Cat');</script>");
                e.Cancel = true;
            }


            petID = Int32.Parse(((TextBox)DetailsView2.Rows[0].Cells[1].Controls[0]).Text);
        }
Example #23
0
        protected void AttachmentsDetailsView_ItemInserting(object sender, DetailsViewInsertEventArgs e)
        {
            // Entities ctx = new Entities();
            byte[]     myFileBytes = null;
            FileUpload myUpload    = (FileUpload)DetailsView1.FindControl("FileUpload1");


            // Need  if not post back

            if (myUpload.HasFile)
            {
                try
                {
                    myFileBytes = myUpload.FileBytes;

                    e.Values["REQUEST_ID"]    = Convert.ToDecimal(Session["ccREQUESTID"]);
                    e.Values["DATA"]          = myFileBytes;
                    e.Values["FILE_NAME"]     = Path.GetFileName(myUpload.PostedFile.FileName);
                    e.Values["DATE_ATTACHED"] = DateTime.Now;
                    Label3.Text = "Successfully Attached. You may attach another or select button below";
                }

                catch (Exception ex)
                {
                    Label3.Text = Resources.errortestImg_001 + ex.Message.ToString();
                    e.Cancel    = true;
                }
            }

            else
            {
                Label3.Text = "You have not specified a file.";
                e.Cancel    = true;
            }
        }
Example #24
0
 protected void EditForm_ItemInserting(object sender, DetailsViewInsertEventArgs e)
 {
     if (e != null)
     {
         e.Cancel = (!DatabaseExists(e.Values));
     }
 }
Example #25
0
    protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        if (e.Values["StartingDate"] != null)
        {
            if (!Validator.IsDate(e.Values["StartingDate"].ToString()))
            {
                e.Cancel      = true;
                lblError.Text = "Starting Date is an invalid date";
            }
        }
        else
        {
            lblError.Text = "Please select a Start Date";
            e.Cancel      = true;
        }
        if (e.Values["frequency"] == null)
        {
            lblError.Text = "Please select a frequency";
            e.Cancel      = true;
        }

        if (e.Values["task"] == null)
        {
            lblError.Text = "Please insert a task";
            e.Cancel      = true;
        }
    }
Example #26
0
    protected void MembershipUserDetailsView_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        TextBox password = MembershipUserDetailsView.FindControl("PasswordTextBox") as TextBox;

        if (password != null)
            e.Values.Add("Password", password.Text);
    }
Example #27
0
 protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
 {
     if (ModelState.IsValid) //verifica se é válido
     {
         string connectionString = ConfigurationManager.ConnectionStrings["DoctorWebConnectionString"].ToString();
         using (SqlConnection con = new SqlConnection(connectionString))
         {
             using (SqlCommand cmdAcesso = new SqlCommand("select * " +
                                                          " from dbo.usuario where usuario='" + e.Values[0].ToString() + "'", con))
             {
                 con.Open();
                 try
                 {
                     cmdAcesso.ExecuteNonQuery();
                 }
                 catch
                 {
                     this.ClientScript.RegisterClientScriptBlock(this.GetType(), "Alerta", "<script>alert('Erro na conexão do banco de dados.')</script>");
                 }
                 SqlDataReader drsretorno = cmdAcesso.ExecuteReader();
                 // esta action trata o post (login)
                 if (drsretorno.HasRows)
                 {
                     this.ClientScript.RegisterClientScriptBlock(this.GetType(), "Alerta", "<script>alert('Usuário já cadastrado.')</script>");
                     e.Cancel = true;
                 }
             }
         }
     }
 }
Example #28
0
        protected void DetailsView_ItemInserting(object sender, DetailsViewInsertEventArgs e)
        {
            InfoList.Items.Clear();

            string name = e.Values["Name"] as string;
            string csis = e.Values["ConnstringIS"] as string;
            string cswb = e.Values["ConnstringWeb"] as string;

            CE.Project newProject = new CE.Project(0, name, mm.DbServer, cswb, csis, 0);

            BasicValidation(newProject);
            if (InfoList.Items.Count > 0)
            {
                e.Cancel = true;
                return;
            }

            try
            {
                mm.SysDriver.InsertProject(newProject);
            }
            catch (ConstraintException ce) {
                InfoList.Items.Add(ce.Message);
                e.Cancel = true;
                return;
            }
            Response.RedirectToRoute("ProjectsRoute");
        }
Example #29
0
    protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        int num = GridView1.Rows.Count;

        SqlDataSource1.InsertParameters["Id"].DefaultValue    = Convert.ToString(num + (int.Parse("1")));
        SqlDataSource1.InsertParameters["dates"].DefaultValue = DateTime.Today.ToShortDateString();
    }
Example #30
0
 protected void dtvValorRetidoFonte_ItemInserting(object sender, DetailsViewInsertEventArgs e)
 {
     e.Values["ValorPisRetido"]    = Glass.Conversoes.StrParaDecimal(e.Values["ValorPisRetido"].ToString());
     e.Values["ValorCofinsRetido"] = Glass.Conversoes.StrParaDecimal(e.Values["ValorCofinsRetido"].ToString());
     e.Values["ValorRetido"]       = Glass.Conversoes.StrParaDecimal(e.Values["ValorRetido"].ToString());
     e.Values["BcRetencao"]        = Glass.Conversoes.StrParaDecimal(e.Values["BcRetencao"].ToString());
 }
Example #31
0
 protected void dvRegister_ItemInserting(object sender, DetailsViewInsertEventArgs e)
 {
     e.Values["joinIp"]   = Request.UserHostAddress;
     e.Values["joinDate"] = DateTime.Now;
     e.Values["userType"] = "User";
     e.Values["cityId"]   = ((DropDownList)(dvRegister.FindControl("ddlCity"))).SelectedValue;
 }
        //插入
        protected void dvBrand_ItemInserting(object sender, DetailsViewInsertEventArgs e)
        {
            TextBox txtBrandName = (TextBox)dvBrand.FindControl("txtAddBrandName");

            try
            {
                Brand b = new Brand();
                b.BrandName = txtBrandName.Text;

                bm.AddBrand(b);

                if (b.BrandId == -1)
                {
                    lblInfo.Text = "新增失败,品牌名称已存在";
                    return;
                }

                lblInfo.Text = "新增成功,新增的编号:" + b.BrandId;

                dvBrand.ChangeMode(DetailsViewMode.ReadOnly);
                bindBrandById(b.BrandId);
            }
            catch (Exception ex)
            {
                lblInfo.Text = "新增失败,异常:" + ex.Message;
            }
        }
        protected void ActivitiesDetailsView_ItemInserting(object sender, DetailsViewInsertEventArgs e)
        {
            DetailsView  vw = (DetailsView)sender;
            DropDownList ddApplicationDetailsTypes = ((DropDownList)vw.FindControl("ddApplicationDetailsTypes")) as DropDownList;
            DropDownList ddGroupsDetails           = (DropDownList)vw.FindControl("ddGroupsDetails") as DropDownList;

            SueetieApplication sueetieApplication = new SueetieApplication();

            if (e.Values["ApplicationKey"] == null || e.Values["ApplicationID"] == null)
            {
                sueetieApplication.ApplicationKey = "ERROR";
                sueetieApplication.Description    = "All fields required";
            }
            else
            {
                sueetieApplication.ApplicationID     = int.Parse(e.Values["ApplicationID"].ToString().Trim());
                sueetieApplication.ApplicationKey    = e.Values["ApplicationKey"].ToString();
                sueetieApplication.Description       = e.Values["Description"].ToString();
                sueetieApplication.GroupID           = int.Parse(ddGroupsDetails.SelectedValue);
                sueetieApplication.ApplicationTypeID = int.Parse(ddApplicationDetailsTypes.SelectedValue);
            }


            e.Values.Remove("GroupID");
            e.Values.Remove("Description");
            e.Values.Remove("ApplicationTypeID");
            e.Values.Remove("ApplicationKey");
            e.Values.Add("appKey", sueetieApplication.ApplicationKey);
            e.Values.Add("appDescription", sueetieApplication.Description);
            e.Values.Add("groupID", sueetieApplication.GroupID);
            e.Values.Add("appTypeID", sueetieApplication.ApplicationTypeID);
        }
Example #34
0
 protected void dv_Organ_ItemInserting(object sender, DetailsViewInsertEventArgs e)
 {
     DropDownList mydl = (DropDownList)dv_Organ.FindControl("ddl_Superior");
     if (mydl != null)
     {
         e.Values["Superior"] = mydl.Items[mydl.SelectedIndex].Value;
     }
 }
    protected void NewCategory_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        // Reference the FileUpload controls
        FileUpload PictureUpload = (FileUpload)NewCategory.FindControl("PictureUpload");
        if (PictureUpload.HasFile)
        {
            // Make sure that a JPG has been uploaded
            if (string.Compare(System.IO.Path.GetExtension(PictureUpload.FileName), ".jpg", true) != 0 &&
                string.Compare(System.IO.Path.GetExtension(PictureUpload.FileName), ".jpeg", true) != 0)
            {
                UploadWarning.Text = "Only JPG documents may be used for a category's picture.";
                UploadWarning.Visible = true;
                e.Cancel = true;
                return;
            }
        }
        else
        {
            // No picture uploaded!
            UploadWarning.Text = "You must provide a picture for the new category.";
            UploadWarning.Visible = true;
            e.Cancel = true;
            return;
        }

        // Set the value of the picture parameter
        e.Values["picture"] = PictureUpload.FileBytes;

        // Reference the FileUpload controls
        FileUpload BrochureUpload = (FileUpload)NewCategory.FindControl("BrochureUpload");
        if (BrochureUpload.HasFile)
        {
            // Make sure that a PDF has been uploaded
            if (string.Compare(System.IO.Path.GetExtension(BrochureUpload.FileName), ".pdf", true) != 0)
            {
                UploadWarning.Text = "Only PDF documents may be used for a category's brochure.";
                UploadWarning.Visible = true;
                e.Cancel = true;
                return;
            }

            const string BrochureDirectory = "~/Brochures/";
            string brochurePath = BrochureDirectory + BrochureUpload.FileName;
            string fileNameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(BrochureUpload.FileName);

            int iteration = 1;

            while (System.IO.File.Exists(Server.MapPath(brochurePath)))
            {
                brochurePath = string.Concat(BrochureDirectory, fileNameWithoutExtension, "-", iteration, ".pdf");
                iteration++;
            }

            // Save the file to disk and set the value of the brochurePath parameter
            BrochureUpload.SaveAs(Server.MapPath(brochurePath));
            e.Values["brochurePath"] = brochurePath;
        }
    }
    protected void dvDocument_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        string DocName = default(System.String);
        int DocStatus = default(System.Int32);
        System.DateTime LastModifyDate = default(System.DateTime);

        //for file
        FileUpload FileUploadControl = new FileUpload();
        FileUploadControl = (FileUpload)dvDocument.FindControl("Upload");
        if ((FileUploadControl != null))
        {
            //Create GUID and modify Document Name - This will ensure that document will be unique for all users even if they use same name
            DocName = System.Guid.NewGuid() + "_" + FileUploadControl.FileName.ToString();
            //check if we have Document name
            if (!string.IsNullOrEmpty(DocName))
            {
                //Save the actual file in the documents folder- DocumentsUploadLocation
                //FileUploadControl.SaveAs(Server.MapPath(DocName);
                FileUploadControl.SaveAs(Server.MapPath(ConfigurationManager.AppSettings["DocumentsUploadLocation"] + DocName));
            }
            else
            {
                //There is not file to attach so inform the user
                ClientScript.RegisterStartupScript(this.GetType(), "NoDocument", ("<script> alert('Please click on Browse button and select document to attach.'); </script>"));
                e.Cancel = true;
            }

        }
        //For LastModifyDate
        {
            TextBox LastModifyDateCal = new TextBox();
            LastModifyDateCal = (TextBox)dvDocument.FindControl("LastModifyDate");
            if ((LastModifyDateCal != null))
            {
                if (!string.IsNullOrEmpty(LastModifyDateCal.Text))
                {
                    LastModifyDate = Convert.ToDateTime(LastModifyDateCal.Text.Trim());
                }

            }

        }
        //For Document Status
        DropDownList DocStatusDDList = new DropDownList();
        DocStatusDDList = (DropDownList)dvDocument.FindControl("ddlDocStatus");
        if ((DocStatusDDList != null))
        {
            DocStatus = Convert.ToInt32(DocStatusDDList.SelectedValue);

        }
        if (!e.Cancel)
        {
            new SandlerRepositories.DocumentsRepository().Insert(Convert.ToInt32(ddlOpportunity.SelectedValue), Convert.ToInt32(ddlCompany.SelectedValue), DocStatus, DocName, LastModifyDate,CurrentUser);
            lblResult.Text = "Document attached Successfully!";
        }
    }
Example #37
0
    protected void dvGame_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        FileUpload fuGameImage = (FileUpload)dvGame.FindControl("fuGameImage");
        string sVirtualFolder = "~/GamePics/";
        string sPhysicalFolder = Server.MapPath(sVirtualFolder);
        string sFileName = Guid.NewGuid().ToString();
        string sExtension = System.IO.Path.GetExtension(fuGameImage.FileName);

        fuGameImage.SaveAs(System.IO.Path.Combine(sPhysicalFolder, sFileName + sExtension));
        e.Values["GamePictureURL"] = sVirtualFolder + sFileName + sExtension;
    }
Example #38
0
    protected void dvSelectedRole_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        TextBox tbRoleID = dvSelectedRole.FindControl("tbRoleID") as TextBox;
        if (tbRoleID != null)
        {
            if (string.IsNullOrEmpty(tbRoleID.Text))
            {
                e.Cancel = true;
                lblErrorDescription.Text = (string) this.GetLocalResourceObject("NoRoleID");
                return;
            }

            foreach (Role role in Role.GetAllRoles())
            {
                if (string.Compare(tbRoleID.Text, role.RoleID) == 0)
                {
                    e.Cancel = true;
                    lblErrorDescription.Text = string.Format((string) this.GetLocalResourceObject("RoleExists"),
                                                             tbRoleID.Text);
                    return;
                }
            }
        }

        Controls_MLTextBox mltbRoleName = dvSelectedRole.FindControl("mltbRoleName") as Controls_MLTextBox;
        if (mltbRoleName != null)
        {
            e.Values["Name"] = mltbRoleName.MultilingualText;
            if (string.IsNullOrEmpty(mltbRoleName.MultilingualText.ToString()))
            {
                e.Cancel = true;
                lblErrorDescription.Text = (string) this.GetLocalResourceObject("NoRoleName");
                return;
            }
        }

        Controls_MLTextBox mltbRoleDescription = dvSelectedRole.FindControl("mltbRoleDescription") as Controls_MLTextBox;
        if (mltbRoleDescription != null)
        {
            e.Values["Description"] = mltbRoleDescription.MultilingualText;
            if (string.IsNullOrEmpty(mltbRoleDescription.MultilingualText.ToString()))
            {
                e.Cancel = true;
                lblErrorDescription.Text = (string) this.GetLocalResourceObject("NoRoleDescription");
                return;
            }
        }
    }
    protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        DropDownList ddl;
        ddl = (DropDownList)DetailsView1.FindControl("ddlStateInsert");
        e.Values["StateID"] = ddl.SelectedValue;

        ddl = (DropDownList)DetailsView1.FindControl("ddlCountryInsert");
        e.Values["CountryID"] = ddl.SelectedValue;

        ddl = (DropDownList)DetailsView1.FindControl("ddlEduLevelInsert");
        e.Values["EducationLevelID"] = ddl.SelectedValue;

        ddl = (DropDownList)DetailsView1.FindControl("ddlJobTypeInsert");
        e.Values["JobTypeID"] = ddl.SelectedValue;

        e.Values["PostedBy"] = Profile.UserName;
        e.Values["CompanyID"]=Profile.Employer.CompanyID.ToString();
        e.Values["PostingDate"]= DateTime.Today.ToString("MM/dd/yyyy");
    }
 protected void DV_ItemInsert(object sender, DetailsViewInsertEventArgs e)
 {
     TextBox txtb_uname =(TextBox)((DetailsView)sender).Rows[0].Cells[1].Controls[0];
     TextBox txtb_eaddress = (TextBox)((DetailsView)sender).Rows[1].Cells[1].Controls[0];
     if (cns.State != ConnectionState.Open)
         cns.Open();
     ds.ConnectionString = ConfigurationManager.ConnectionStrings["cns"].ConnectionString;
     SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["cns"].ConnectionString);
     SqlCommand command = new SqlCommand("spAddandUpdateUser", sqlcon);
     command.CommandType = CommandType.StoredProcedure;
     //command.Parameters.Add("@Userid", SqlDbType.Int).Value = int.Parse(row.Cells[2].Text);
     command.Parameters.Add("@Username", SqlDbType.VarChar).Value = txtb_uname.Text;
     command.Parameters.Add("@EmailAddress", SqlDbType.VarChar).Value = txtb_eaddress.Text;
     sqlcon.Open();
     command.ExecuteNonQuery();
     sqlcon.Close();
     detailsview_bind();
     gridview_bind();
 }
    protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        e.Values["InDate"] = DateTime.Now;

        FileUpload fileUpload = (FileUpload)DetailsView1.FindControl("FileUploadImage");
        if (fileUpload.HasFile)
        {
            string upload;

            if (drvvv.GetFile.UploadFileUpload(fileUpload, true, false, false, out upload))
            {
                e.Values["ImgName"] = upload;
            }
            else
            {
                e.Cancel = true;
                ((Label)DetailsView1.FindControl("LabelUploadImage")).Text = upload;
            }
        }
    }
    protected void SuperForm1_Inserting(object sender, DetailsViewInsertEventArgs e)
    {
        OleDbConnection myConn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("../App_Data/Northwind.mdb"));
        myConn.Open();

        OleDbCommand myComm = new OleDbCommand("INSERT INTO Orders (ShipName, ShipCity, ShipRegion, ShipCountry, ShipPostalCode, OrderDate, Sent) VALUES(@ShipName, @ShipCity, @ShipRegion, @ShipCountry, @ShipPostalCode, @OrderDate, @Sent)", myConn);

        myComm.Parameters.Add("@ShipName", OleDbType.VarChar).Value = e.Values["ShipName"].ToString();
        myComm.Parameters.Add("@ShipCity", OleDbType.VarChar).Value = e.Values["ShipCity"].ToString();
        myComm.Parameters.Add("@ShipRegion", OleDbType.VarChar).Value = e.Values["ShipRegion"].ToString();
        myComm.Parameters.Add("@ShipCountry", OleDbType.VarChar).Value = e.Values["ShipCountry"].ToString();
        myComm.Parameters.Add("@ShipPostalCode", OleDbType.VarChar).Value = e.Values["ShipPostalCode"].ToString();
        myComm.Parameters.Add("@OrderDate", OleDbType.Date).Value = e.Values["OrderDate"].ToString();
        myComm.Parameters.Add("@Sent", OleDbType.Boolean).Value = e.Values["Sent"].ToString();

        myComm.ExecuteNonQuery();
        myConn.Close();

        SuperForm1.Visible = false;
        MessagePanel.Visible = true;
    }
    protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["fccl2ConnectionString"].ConnectionString);
        SqlCommand cmd = new SqlCommand();
        cmd.Connection = cnn;
        string cod = e.Values["CodPrelevator"].ToString();


        cmd.CommandText = "SELECT * from Prelevatori WHERE CodPrelevator ='" + cod + "'";
        cnn.Open();
        SqlDataReader reader = cmd.ExecuteReader();
        if (reader.Read())
        {
            Label2.Text = "Codul " + cod + " exista deja!";
            e.Cancel = true;
        }
        else
            Label2.Text = "";

        reader.Close();
        cnn.Close();
    }
Example #44
0
	protected void UploadPhotoDetailsView_ItemInserting(object sender, DetailsViewInsertEventArgs e)
	{
		byte[] uploadedOriginal = e.Values["UploadBytes"] as byte[];
		if (uploadedOriginal == null || uploadedOriginal.Length == 0)
		{
			e.Cancel = true;
			UploadErrorMessage.Visible = false;
		}
		else
		{
			try
			{
				// adding resized photo bytes to arguments

				byte[] fullSize = PhotosDB.ResizeImageFile(uploadedOriginal, PhotoSize.Full);
				byte[] mediumSize = PhotosDB.ResizeImageFile(uploadedOriginal, PhotoSize.Medium);
				byte[] smallSize = PhotosDB.ResizeImageFile(uploadedOriginal, PhotoSize.Small);

				e.Values.Add("bytesFull", fullSize);
				e.Values.Add("bytesMedium", mediumSize);
				e.Values.Add("bytesSmall", smallSize);

				// removing original upload bytes from arguments
				e.Values.Remove("UploadBytes");

				// if this is the first ad photo uploaded, use it as the preview
				bool useAsPreview = (PhotoGridView.Rows.Count == 0);
				e.Values.Add("useAsPreview", useAsPreview);
				UploadErrorMessage.Visible = false;
			}
			catch
			{
				// image format was not acceptable
				e.Cancel = true;
				UploadErrorMessage.Visible = true;
			}
		}
	}
 protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
 {//inserting into userID field
     e.Values[0] = loggedInUserID;
 }
 protected void SuperForm1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
 {
     e.Values["CountryIds"] = GetSelectedCountries();
 }
Example #47
0
 protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
 {
     DateTime now = DateTime.Now;
     e.Values["post_date"] = now;
 }
Example #48
0
 //插入数据时候
 protected void DetailsView2_ItemInserting(object sender, DetailsViewInsertEventArgs e)
 {
     string strTime = ((HtmlInputText)DetailsView2.Controls[0].FindControl("iptStartTime")).Value;
     SqlDataSource2.InsertParameters["td_time"].DefaultValue = strTime;
 }
Example #49
0
    protected void dvAddTransferFee_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        try
        {
            int lineID = 0;
            string description = "";
            decimal feeQuantity = 0M;

            Label lblLineID = (Label)dvAddTransferFee.FindControl("lblLineID");
            if (lblLineID != null)
                int.TryParse(lblLineID.Text, out lineID);
            TextBox txtDescription = (TextBox)dvAddTransferFee.FindControl("txtDescription");
            if (txtDescription != null)
                description = txtDescription.Text;
            DecimalBox dbBox = (DecimalBox)dvAddTransferFee.FindControl("dbTransferFee");
            if (dbBox != null)
                feeQuantity = dbBox.Value;

            if (JournalEntryLinesAdapter.AddTransferFee(lineID, feeQuantity, description))
            {
                ScreenMode = ScreenModeState.Main;
                ctlJournalEntryLines.DataBind();
                displayStatementDetails();
            }
        }
        catch (Exception ex)
        {
            lblErrorMessageMain.Text = Utility.GetCompleteExceptionMessage(ex);
        }
    }
Example #50
0
    protected void ThumbnailsDetailsView_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        if (!Page.IsValid)
            return;

        FileUpload uploadedFile = ThumbnailsDetailsView.FindControl("ProjectFileUpload") as FileUpload;

        if (uploadedFile != null && uploadedFile.HasFile)
        {
            e.Values.Add("ID", Guid.NewGuid());
            e.Values.Add("ContentType", uploadedFile.PostedFile.ContentType);
            e.Values.Add("ContentLength", uploadedFile.PostedFile.ContentLength);
            e.Values.Add("InputStream", uploadedFile.PostedFile.InputStream);
        }
    }
 protected void SuperForm1_Inserting(object sender, DetailsViewInsertEventArgs e)
 {
     SuperForm1.Visible = false;
     MessagePanel.Visible = true;
 }
 protected void detailsview_insert(object sender, DetailsViewInsertEventArgs e)
 {
 }
Example #53
0
    protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        SqlDataSource1.InsertParameters["vp_date"].DefaultValue = strDate;

        string strBerthTime = ((HtmlInputText)DetailsView1.Controls[0].FindControl("iptBerthTime")).Value;
        SqlDataSource1.InsertParameters["vp_betrthtime"].DefaultValue = strBerthTime;

        string strDepartTime = ((HtmlInputText)DetailsView1.Controls[0].FindControl("iptDepartTime")).Value;
        SqlDataSource1.InsertParameters["vp_departtime"].DefaultValue = strDepartTime;

        string strSide = ((DropDownList)DetailsView1.Controls[0].FindControl("ddlSide")).SelectedValue;
        SqlDataSource1.InsertParameters["vp_berthside"].DefaultValue = strSide;

        string strVesselCode = System.DateTime.Now.Millisecond.ToString();
        SqlDataSource1.InsertParameters["vp_vesselcode"].DefaultValue = strVesselCode;
    }
 protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
 {
     
 }
 protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
 {
     e.Values["UpdateDateTime"] = DateTime.Now;
 }
 protected void SuperForm1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
 {
     e.Values["Image"] = fileName;
 }
Example #57
0
    protected void ControlView_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        string name = (ControlView.Rows[0].FindControl("NewControlNameTextbox") as TextBox).Text.Trim();
        string type = (ControlView.Rows[0].FindControl("NewControlTypeList") as DropDownList).SelectedValue.ToString().Trim();

        try
        {
            List<JobTypeControlCookie> data = null;
            if (JobTypeID.Value == "")
                data = JobTypeControlCart.AddItemNewJob(-1, name, type, ControlsGridView.Rows.Count);
            else
                data = JobTypeControlCart.AddItem(-1, name, type);

            JobTypeControlCart.SaveCart(data);
            ControlsGridView.DataSource = data;
            ControlsGridView.DataBind();
        }
        catch (Exception ex)
        {
            FormMessage.ForeColor = Color.Red;
            FormMessage.Text = ex.Message;
        }
    }
 protected void SuperForm1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
 {
     e.Values["Notes"] = ((Obout.Ajax.UI.HTMLEditor.Editor)((DetailsViewRow)SuperForm1.Rows[14]).FindControl("Editor1")).Content;
 }
 protected void SuperForm1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
 {
     e.Values["ShipCountry"] = ((Obout.ListBox.ListBox)((DetailsViewRow)SuperForm1.Rows[4]).FindControl("ShipCountry")).SelectedValue;
 }
Example #60
0
 protected void DetailsView3_ItemInserting(object sender, DetailsViewInsertEventArgs e)
 {
     string strPass = ((DropDownList)DetailsView3.Controls[0].FindControl("ddlPass")).SelectedValue;
     SqlDataSource3.InsertParameters["rm_passs"].DefaultValue = strPass;
 }