protected void grid_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        if (e.RowIndex < Page.Settings.SortedColumns.Count)
            Page.Settings.SortedColumns.RemoveAt(e.RowIndex);

        int reportColumnsSchemaId = Convert.ToInt32((grid.Rows[e.RowIndex].Cells[0].Controls[1] as DropDownList).SelectedValue);
        bool asc = Convert.ToBoolean((grid.Rows[e.RowIndex].Cells[1].Controls[1] as DropDownList).SelectedValue);


        // Verifies if yet inserted
        ReportSort sortItem = Page.Settings.SortedColumns.Find(p => p.ReportColumnsSchemaId == reportColumnsSchemaId);

        if (sortItem == null)
        {
            sortItem = new ReportSort();
            sortItem.ReportTablesSchemaId = Page.Settings.Report.ReportTablesSchemaId.Value;
            sortItem.ReportColumnsSchemaId = reportColumnsSchemaId;
            sortItem.Ascending = asc;
            sortItem.Name = (grid.Rows[e.RowIndex].Cells[0].Controls[1] as DropDownList).SelectedItem.Text;
            Page.Settings.SortedColumns.Insert(e.RowIndex, sortItem);
        }
        else
        {
            sortItem.Ascending = asc;
        }
        BindGrid(-1);
    }
示例#2
0
 public void GridViewNews_RowUpdating(Object sender, GridViewUpdateEventArgs e)
 {
     int index = GridViewNews.EditIndex;
     GridViewRow row = GridViewNews.Rows[index];
     TextBox description = (TextBox)row.FindControl("TextBoxDescription");
     e.NewValues["description"] = description.Text;
 }
示例#3
0
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        TextBox my_RealQuantity;

        String my_MaterialID = gv.DataKeys[e.RowIndex].Value.ToString();
        String my_MaterialName = gv.Rows[e.RowIndex].Cells[2].Text;
        String my_SystemQuantity = gv.Rows[e.RowIndex].Cells[3].Text;
        my_RealQuantity = (TextBox)gv.Rows[e.RowIndex].Cells[4].Controls[0];
        String my_MaterialCost = gv.Rows[e.RowIndex].Cells[5].Text;


        if (!IsNumeric(my_RealQuantity.Text)) 
        {
            ShowMsg2(UpdatePanel1, "請輸入數字");
            return;
        }

        //檢查更新是否成功
        if (UpdateICS_Material(my_MaterialID, my_MaterialName, my_SystemQuantity, my_RealQuantity, my_MaterialCost))
        {
            ShowMsg2(UpdatePanel1, "更新成功");
        }
        else
        {
            ShowMsg2(UpdatePanel1, "更新失敗");
        }

        gv.EditIndex = -1;
        InitData();
        SearchData();
    }
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        string sno = (GridView1.Rows[e.RowIndex].Cells[3].Controls[0] as TextBox).Text;
        string sname = (GridView1.Rows[e.RowIndex].Cells[4].Controls[0] as TextBox).Text;
        string ssex = (GridView1.Rows[e.RowIndex].Cells[5].Controls[0] as TextBox).Text;
        string sage = (GridView1.Rows[e.RowIndex].Cells[6].Controls[0] as TextBox).Text;
        string sdept = (GridView1.Rows[e.RowIndex].Cells[7].Controls[0] as TextBox).Text;
        using (
            SqlConnection connection =
                new SqlConnection(connectionString))
        {
            string commanText =
                string.Format("UPDATE Student SET Sname = '{0}', Ssex = '{1}', Sage = '{2}', Sdept = '{3}' WHERE Sno = '{4}'", sname,
                    ssex, sage, sdept, sno);
            var command = new SqlCommand(commanText, connection);
            if (connection.State != ConnectionState.Open)
            {
                connection.Open();
            }
            command.ExecuteNonQuery();
            GridView1.EditIndex = -1;
            BindGridView();

        }
    }
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        int _selectedRowIndex = e.RowIndex;
           // HiddenField hidden = (HiddenField)
        int projID = (int)GridView1.DataKeys[_selectedRowIndex].Values[2];
        int rowIndex = GridView1.SelectedIndex;
          //  int projID = Convert.ToInt32( GridView1.DataKeys[rowIndex].Values[2]);
           // int projID = 4;
        TextBox txtForMark = (TextBox)(GridView1.Rows[e.RowIndex].FindControl("theMarkTextBox"));
        string newMark = txtForMark.Text.ToString();
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
        try
        {
          //  con.Open();
            string upDate = "UPDATE StudentsProjects SET mark=" + newMark + " WHERE projectID=" + projID + " ";
          //  SqlCommand updateCommand = new SqlCommand(upDate, con);
          //  updateCommand.CommandType = CommandType.Text;
           // updateCommand.ExecuteNonQuery();
           // con.Close();
           // SqlDataSource1.Update();
            SqlDataSource1.UpdateCommand = upDate;
          //  GridView1.DataSource = SqlDataSource1;

          //  GridView1.DataBind();
        }
        catch { }
        //SqlDataSource1.Update();
    }
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        obj = (ObjectDataSource)Session["obj"];
        obj.UpdateMethod = "UpdateStudent";
        obj.UpdateParameters.Clear();
        Label id = (Label)GridView1.Rows[e.RowIndex].FindControl("EditID");
        TextBox F_name = (TextBox)GridView1.Rows[e.RowIndex].FindControl("Edit_F_Name");
        TextBox L_Name = (TextBox)GridView1.Rows[e.RowIndex].FindControl("Edit_L_Name");
        TextBox Address = (TextBox)GridView1.Rows[e.RowIndex].FindControl("Edit_Address");
        TextBox Age = (TextBox)GridView1.Rows[e.RowIndex].FindControl("Edit_Age");
        DropDownList Dept = (DropDownList)GridView1.Rows[e.RowIndex].FindControl("Edit_Dept");
        DropDownList Leader = (DropDownList)GridView1.Rows[e.RowIndex].FindControl("Edit_Leader");
        TextBox password = (TextBox)GridView1.Rows[e.RowIndex].FindControl("Edit_Password");
        TextBox UserName = (TextBox)GridView1.Rows[e.RowIndex].FindControl("Edit_UserName");

        obj.UpdateParameters.Add("St_ID", id.Text);
        obj.UpdateParameters.Add("F_Name", F_name.Text);
        obj.UpdateParameters.Add("L_Name", L_Name.Text);
        obj.UpdateParameters.Add("Address", Address.Text);
        obj.UpdateParameters.Add("Age", Age.Text);
        obj.UpdateParameters.Add("Dept_No", Dept.SelectedValue);
        obj.UpdateParameters.Add("Leader", Leader.SelectedValue);
        obj.UpdateParameters.Add("password", password.Text);
        obj.UpdateParameters.Add("UserName", UserName.Text);
        obj.Update();

        GridView1.EditIndex = -1;
        GridView1.DataSource = obj;
        GridView1.DataBind();
        Session["obj"] = obj;
    }
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        var List = new List<Student_Registration_Form>();

        var db = new DataClassesDataContext();

        string _accountType, _email, _contactMethod, _campus, _faculty, _course;
        int _phone, _mobile;

        _accountType = ((TextBox) (GridView1.Rows[e.RowIndex].FindControl("textAccType"))).Text;
        _email = ((TextBox) (GridView1.Rows[e.RowIndex].FindControl("textEmail"))).Text;
        //_citizenship = ((TextBox)(GridView1.Rows[e.RowIndex].FindControl("Marital_Status"))).Text;
        _contactMethod = ((TextBox) (GridView1.Rows[e.RowIndex].FindControl("textContact"))).Text;
        _campus = ((TextBox) (GridView1.Rows[e.RowIndex].FindControl("textCampus"))).Text;
        _faculty = ((TextBox) (GridView1.Rows[e.RowIndex].FindControl("textFaculty"))).Text;
        _course = ((TextBox) (GridView1.Rows[e.RowIndex].FindControl("textCourse"))).Text;
        //_phone = ((TextBox)(GridView1.Rows[e.RowIndex].FindControl.("textPhone"))).ToString();
        //_mobile = ((TextBox)(GridView1.Rows[e.RowIndex].FindControl("textMobile"))).Text;

        var update = (from u in db.Student_Registration_Forms
            where u.Accomodition_Type == _accountType
            where u.Email == _email
            //where u.Marital_Status == _citizenship
            where u.Contact == _contactMethod
            where u.campus == _campus
            where u.Faculty == _faculty
            where u.Courses == _course
            select u);


        GridView1.DataSource = List;
        db.SubmitChanges();
        BindGrid();
    }
示例#8
0
 protected void gvmon_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     mhdto.MaMon = gvmon.DataKeys[e.RowIndex].Value.ToString();
     TextBox tx = (TextBox)gvmon.Rows[e.RowIndex].FindControl("txttenmon");
     Label lb = (Label)gvto.Rows[e.RowIndex].FindControl("lblmamon");
     string tenmon = sv.To_searchbyMa(lb.Text.ToString()).Rows[0]["Tên môn"].ToString();
     if (sv.MonHoc_checkTrungtenmon(tx.Text.ToString()) == true && tx.Text.ToString() != tenmon)
     {
         Response.Write("<script>alert('Tên môn học này đã tồn tại !')</script>");
     }
     else
     {
         TextBox heso = (TextBox)gvmon.FooterRow.FindControl("txtheso");
         mhdto.TenMon = tx.Text.ToString();
         mhdto.HeSo = int.Parse(heso.Text.ToString());
         gvmon.EditIndex = -1;
         int result = mhbus.Update(mhdto);
         if (result > 0)
         {
             Response.Write("<script>alert('Sửa thông tin thành công')</script>");
         }
         else
         {
             Response.Write("<script>alert('Sửa thất bại')</script>");
         }
         //Response.Redirect("QuanlyTo.aspx");
         gvmon.DataSource = mhbus.List();
         gvmon.DataBind();
     }
 }
    protected void GrdLoadJobCompany_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        int indexrow = e.RowIndex;
        string tid = ((Label)GrdLoadJobCompany.Rows[indexrow].FindControl("PostJobId")).Text;

        Response.Redirect("~/ShowJobDetails.aspx?PostJobId=" + tid);
    }
示例#10
0
 // Update a product
 protected void grid_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     // Retrieve updated data
     try
     {
       string id = grid.DataKeys[e.RowIndex].Value.ToString();
       string name = ((TextBox)grid.Rows[e.RowIndex].FindControl("nameTextBox")).Text;
       string description = ((TextBox)grid.Rows[e.RowIndex].FindControl("descriptionTextBox")).Text;
       string price = ((TextBox)grid.Rows[e.RowIndex].FindControl("priceTextBox")).Text;
       string thumbnail = ((TextBox)grid.Rows[e.RowIndex].FindControl("thumbTextBox")).Text;
       string image = ((TextBox)grid.Rows[e.RowIndex].FindControl("imageTextBox")).Text;
       string promoDept = ((CheckBox)grid.Rows[e.RowIndex].Cells[6].Controls[0]).Checked.ToString();
       string promoFront = ((CheckBox)grid.Rows[e.RowIndex].Cells[7].Controls[0]).Checked.ToString();
       // Execute the update command
       bool success = CatalogAccess.UpdateProduct(id, name, description, price, thumbnail, image, promoDept, promoFront);
       // Cancel edit mode
       grid.EditIndex = -1;
       // Display status message
       statusLabel.Text = success ? "Product update successful" : "Product update failed";
     }
     catch
     {
       // Display error
       statusLabel.Text = "Product update failed";
     }
     // Reload grid
     BindGrid();
 }
    protected void gv_weddingCustomer_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        GridViewRow row = (GridViewRow)gv_weddingCustomer.Rows[e.RowIndex];
        Label lblCustomerID = (Label)row.FindControl("lblid");
        Label lblSalutation = (Label)row.FindControl("lblid1");
        TextBox textFname = (TextBox)row.FindControl("textbox1");
        TextBox textLname = (TextBox)row.FindControl("textbox2");
        TextBox textstate_Address = (TextBox)row.FindControl("textbox3");
        TextBox textCity = (TextBox)row.FindControl("textbox4");
        TextBox textPostelCode = (TextBox)row.FindControl("textbox5");
        TextBox textPhone = (TextBox)row.FindControl("textbox6");
        TextBox textEmail = (TextBox)row.FindControl("textbox7");

        TextBox textCountry = (TextBox)row.FindControl("textbox8");
        TextBox textPassport_num = (TextBox)row.FindControl("textbox9");

        gv_weddingCustomer.EditIndex = -1;
        String customerUpdateQuery = "update Customer set fname = '" + textFname.Text + "',lname = '" + textLname.Text + "' where CustomerID = " + lblCustomerID.Text + " ";

        bool updateResult = dc.insert(customerUpdateQuery);

        lblUpdateMsg.Visible = true;
        if (updateResult == true)
        {
            lblUpdateMsg.Text = "Details of Customer with ID '" + lblCustomerID.Text + "' was sucessly updated!";
        }
        else
        {
            lblUpdateMsg.Text = "Sorry!Unable to be update Details of Customer with ID '" + lblCustomerID.Text + "'!";
        }
        fillGrid();
    }
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        //获取编辑状态下当前行中每一列的值
        //当 GridView 中的某一行处于编辑状态时,可以看成是某个单元格中放置了一个 TextBox 控件
        //所以需要得到这个 TextBox 控件,并获取其中的文本
        string sno = (GridView1.Rows[e.RowIndex].Cells[3].Controls[0] as TextBox).Text;
        string sname = (GridView1.Rows[e.RowIndex].Cells[4].Controls[0] as TextBox).Text;
        string ssex = (GridView1.Rows[e.RowIndex].Cells[5].Controls[0] as TextBox).Text;
        string sage = (GridView1.Rows[e.RowIndex].Cells[6].Controls[0] as TextBox).Text;
        string sdept = (GridView1.Rows[e.RowIndex].Cells[7].Controls[0] as TextBox).Text;

        //获取 DataSet 中与点击了 “编辑” 按钮的这行对应的数据行
        DataRow row = dataSet.Tables[0].Rows[e.RowIndex];
        //修改其中各字段的值
        row["Sno"] = sno;
        row["Sname"] = sname;
        row["Ssex"] = ssex;
        row["Sage"] = sage;
        row["Sdept"] = sdept;

        //提交到数据库中
        dataAdapter.Update(dataSet);
        GridView1.EditIndex = -1;
        BindGridView();
    }
示例#13
0
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        int postid = 0;
        string postcontent = "";
        DateTime modified = DateTime.Now;
        string poststatus = "";
        int rating = 0;

        postid = Convert.ToInt16(((Label)GridView1.Rows[e.RowIndex].FindControl("lblpostid")).Text);
        postcontent = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtPostContent")).Text;
        poststatus = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtstatus")).Text;
        rating = Convert.ToInt16(((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtrating")).Text);

        PostBLL pb = new PostBLL();
           int i= pb.UpdatePost(postid,postcontent,modified,poststatus,rating);
           if (i == 1)
           {
           Response.Write("<script language='javascript'>alert('Post has been updated !');</script>");
           GridView1.DataBind();
           }
           else
           {
           Response.Write("<script language='javascript'>alert('Post is failed to be updated !');</script>");
           GridView1.DataBind();
           }
    }
示例#14
0
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        string cname, c_add, city, desig, j_date, salary, c_per_name, c_per_no, sid;
        cname = ((TextBox)(GridView1.Rows[e.RowIndex].FindControl("TextBox3"))).Text;
        c_add = ((TextBox)(GridView1.Rows[e.RowIndex].FindControl("TextBox4"))).Text;
        city = ((TextBox)(GridView1.Rows[e.RowIndex].FindControl("TextBox5"))).Text;
        desig = ((TextBox)(GridView1.Rows[e.RowIndex].FindControl("TextBox6"))).Text;
        j_date = ((TextBox)(GridView1.Rows[e.RowIndex].FindControl("TextBox7"))).Text;
        salary = ((TextBox)(GridView1.Rows[e.RowIndex].FindControl("TextBox8"))).Text;
        c_per_name = ((TextBox)(GridView1.Rows[e.RowIndex].FindControl("TextBox9"))).Text;
        c_per_no = ((TextBox)(GridView1.Rows[e.RowIndex].FindControl("TextBox10"))).Text;
        sid = GridView1.DataKeys[e.RowIndex].Value.ToString();

        SqlDataSource5.UpdateParameters["cname"].DefaultValue = cname;
        SqlDataSource5.UpdateParameters["c_add"].DefaultValue = c_add;
        SqlDataSource5.UpdateParameters["city"].DefaultValue = city;
        SqlDataSource5.UpdateParameters["desig"].DefaultValue = desig;
        SqlDataSource5.UpdateParameters["j_date"].DefaultValue = j_date;
        SqlDataSource5.UpdateParameters["salary"].DefaultValue = salary;
        SqlDataSource5.UpdateParameters["c_per_name"].DefaultValue = c_per_name;
        SqlDataSource5.UpdateParameters["c_per_no"].DefaultValue = c_per_no;
        SqlDataSource5.UpdateParameters["sid"].DefaultValue = sid;
        SqlDataSource5.Update();
        GridView1.EditIndex = -1;
        GridView1.DataBind();
    }
示例#15
0
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        TextBox my_MaterialName, my_PurchaseUnit, my_ConsumeUnit, my_ConversionFactor, my_MaterialSafeQuantity, my_MaterialTypeID, my_MaterialUnit, my_Active;

        String my_NO = gv.DataKeys[e.RowIndex].Value.ToString();
        my_MaterialName = (TextBox)gv.Rows[e.RowIndex].Cells[2].Controls[0];
        my_PurchaseUnit = (TextBox)gv.Rows[e.RowIndex].Cells[3].Controls[0];
        my_ConsumeUnit = (TextBox)gv.Rows[e.RowIndex].Cells[4].Controls[0];
        my_ConversionFactor = (TextBox)gv.Rows[e.RowIndex].Cells[5].Controls[0];
        my_MaterialSafeQuantity = (TextBox)gv.Rows[e.RowIndex].Cells[6].Controls[0];
        my_MaterialTypeID = (TextBox)gv.Rows[e.RowIndex].Cells[7].Controls[0];
        my_MaterialUnit = (TextBox)gv.Rows[e.RowIndex].Cells[8].Controls[0];
        my_Active = (TextBox)gv.Rows[e.RowIndex].Cells[9].Controls[0];

        //檢查更新是否成功
        if (UpdateICS_Material(my_NO, my_MaterialName, my_PurchaseUnit, my_ConsumeUnit, my_ConversionFactor, my_MaterialSafeQuantity, my_MaterialTypeID, my_MaterialUnit, my_Active))
        {
            ShowMsg2(UpdatePanel1, "更新成功");
        }
        else 
        {
            ShowMsg2(UpdatePanel1, "更新失敗");
        }

        gv.EditIndex = -1;
        InitData();
        SearchData();
    }
示例#16
0
 protected void gvTagCategory_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     M_TagCategory model = new M_TagCategory();
     int tagCategoryId = (int)gvTagCategory.DataKeys[e.RowIndex].Value;
     TextBox txtName = gvTagCategory.Rows[e.RowIndex].FindControl("txtName") as TextBox;
     string name = txtName.Text.Trim();
     TextBox txtDesc = gvTagCategory.Rows[e.RowIndex].FindControl("txtDesc") as TextBox;
     string desc = txtDesc.Text.Trim();
     if(name.Length==0||name.Length>20)
     {
         LitMsg.Text = "<script type='text/javascript'>alert('Tag类别名称必须填写');</script>";
         return;
     }
     if(desc.Length>100)
     {
         LitMsg.Text = "<script type='text/javascript'>alert('Tag类别描述不能超过100个字');</script>";
         return;
     }
     model.TagCategoryId = tagCategoryId;
     model.Name = name;
     model.Desc = desc;
     Bll.Update(model);
     gvTagCategory.EditIndex = -1;
     Bind();
 }
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        //Get the CheckBox in the row that is being updated
        CheckBox adminbox = (CheckBox)GridView1.Rows[e.RowIndex].FindControl("CheckBox1");

        //Get the User
        string username = GridView1.Rows[e.RowIndex].Cells[0].Text;

        //get the username from the datakeys collection instead
        //string username1 = GridView1.DataKeys[e.RowIndex].Value.ToString();

        //if the checkbox is checked and the user is not currently an admin, add the user to the admin role
        if(adminbox.Checked && Roles.IsUserInRole(username,"Admin"))
        {
            Roles.AddUserToRole(username, "Admin");
        }

        //if the checkebox is unchecked and the user is currently an admin, remove the user from the Admin role
        if(!adminbox.Checked && Roles.IsUserInRole(username, "Admin"))
        {
            Roles.RemoveUserFromRole(username, "Admin");
        }

        GridView1.EditIndex = -1;
        GridView1.DataBind();
    }
示例#18
0
    protected void GV_UomConversion_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        string BaseQty = ((TextBox)GV_UomConversion.Rows[e.RowIndex].Cells[3].Controls[1]).Text.ToString().Trim();
        string AlterQty = ((TextBox)GV_UomConversion.Rows[e.RowIndex].Cells[5].Controls[1]).Text.ToString().Trim();

        try
        {
            Convert.ToDecimal(BaseQty);
        }
        catch (Exception)
        {
            e.Cancel = true;
            ShowErrorMessage("Common.Decimal.Error", itemMessage);
            return;
        }

        try
        {
            Convert.ToDecimal(AlterQty);
        }
        catch (Exception)
        {
            e.Cancel = true;
            ShowErrorMessage("Common.Decimal.Error", itemMessage);
            return;
        }
    }
 protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     GridViewRow row;
     row = GridView1.Rows[e.RowIndex];
     TextBox t;
     t = (TextBox)row.Cells[3].Controls[0];
     string nename = t.Text;
     t = (TextBox)row.Cells[4].Controls[0];
     string eid = t.Text;
     int eno = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value);
     MySqlCommand cmd = new MySqlCommand("update forum_users set username='******',password=password('" + eid + "') where id=" + eno, con);
     try
     {
         con.Open();
         cmd.ExecuteNonQuery();
         con.Close();
         GridView1.EditIndex = -1;
         binddata();
     }
     catch (Exception ex)
     {
         CreateLogFile log = new CreateLogFile();
         log.ErrorLog(Server.MapPath("../Logs/Errorlog"), "GridView RowUpdating method of Stud_EditDel page for " + Session["loginname"] + ":"+ex.Message);
     }
 }
示例#20
0
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        SQLDB db = new SQLDB();
        string deviceKind = gv.Rows[e.RowIndex].Cells[1].Text;
        TextBox checkcycle;
        checkcycle = (TextBox)gv.Rows[e.RowIndex].Cells[2].Controls[0];

        if (!IsNumeric(checkcycle.Text))
        {
            ShowMsg2(UpdatePanel1, "請輸入數字");
            return;
        }

        //檢查更新是否成功
        string updatestring = "Update  CD_CheckCycle set cycle= '" + checkcycle.Text + "'  where Devicekind = '" + deviceKind + "'";
        if (db.ExecuteStatement(updatestring))
        {
            ShowMsg2(UpdatePanel1, "更新成功");
        }
        else
        {
            ShowMsg2(UpdatePanel1, "更新失敗");
        }

        gv.EditIndex = -1;
        InitData();
        SearchData();
    }
示例#21
0
 protected void GridView2_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     DropDownList ddlevelForMultCh = (DropDownList)(GridView2.Rows[e.RowIndex].FindControl("ddlevelForMultCh"));
     caseOfErr = (DropDownList)(GridView2.Rows[e.RowIndex].FindControl("ddForMultChoCaseOferror"));
     e.NewValues.Add("caseOfError", caseOfErr.SelectedItem.ToString());
     e.NewValues.Add("level", ddlevelForMultCh.SelectedItem.ToString());
 }
    protected void gvMappedInstruments_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        try
        {
            GridViewRow editingRow = (gvMappedInstruments.EditIndex >= 0 ? gvMappedInstruments.Rows[gvMappedInstruments.EditIndex] : null);
            if (editingRow != null)
            {
                DropDownList ddlAssetClass = (DropDownList)Utility.FindControl(editingRow, "ddlAssetClass");
                DropDownList ddlRegionClass = (DropDownList)Utility.FindControl(editingRow, "ddlRegionClass");
                DropDownList ddlInstrumentsCategories = (DropDownList)Utility.FindControl(editingRow, "ddlInstrumentsCategories");
                DropDownList ddlSectorClass = (DropDownList)Utility.FindControl(editingRow, "ddlSectorClass");
                DecimalBox dbMaxWithdrawalAmountPercentage = (DecimalBox)Utility.FindControl(editingRow, "dbMaxWithdrawalAmountPercentage");

                e.NewValues["assetClassId"] = Convert.ToInt32(ddlAssetClass.SelectedValue);
                e.NewValues["regionClassId"] = Convert.ToInt32(ddlRegionClass.SelectedValue);
                e.NewValues["instrumentsCategoryId"] = Convert.ToInt32(ddlInstrumentsCategories.SelectedValue);
                e.NewValues["sectorClassId"] = Convert.ToInt32(ddlSectorClass.SelectedValue);
                e.NewValues["maxWithdrawalAmountPercentage"] = dbMaxWithdrawalAmountPercentage.Value;
            }
        }
        catch (Exception ex)
        {
            e.Cancel = true;
            lblErrorMessage.Text = Utility.GetCompleteExceptionMessage(ex);
        }
    }
示例#23
0
    protected void GvOrder_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        int i = e.RowIndex;

        DataRow rOrder = TableOrder.Rows[i];

        GridViewRow row = GvOrder.Rows[e.RowIndex];

        double f = -1;
        double.TryParse(((TextBox)(row.Cells[1].Controls[0])).Text,out f);

        int quant = (int)f;
        if (quant < 0) return;

        string s = (string)rOrder[4];

        if (s[0] > '9' || s[0] <= '0')
        {
            //get rid of "$"
            s = s.Substring(1);
        }

        rOrder["SubPrice"] = (Convert.ToDouble(s) * quant).ToString("C");

        rOrder["Quantity"] = quant;

        GvOrder.EditIndex = -1;

        Update();
    }
示例#24
0
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        try
        {
            UserDetails userDetails = new UserDetails();

            userDetails.userID = GridView1.Rows[e.RowIndex].Cells[0].Text;
            userDetails.firstName = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[1].Controls[0])).Text;
            userDetails.lastName = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[2].Controls[0])).Text;
            userDetails.phone = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[5].Controls[0])).Text;
            userDetails.cityID = int.Parse(((DropDownList)(GridView1.Rows[e.RowIndex].Cells[3].FindControl("DropDownList1"))).SelectedValue);
            userDetails.address = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[6].FindControl("TextBox1"))).Text;
            userDetails.state = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[6].FindControl("TextBox3"))).Text;
            userDetails.zipCode = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[6].FindControl("TextBox2"))).Text;
            

            UserService userService = new UserService();
            userService.UpdateUserDetails(userDetails);

            GridView1.EditIndex = -1;
            populateGrid();
        }
        catch (Exception ex)
        {
            Label1.Text = ex.Message;
        }
    }
    protected void gridStudent_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        SqlConnection connection = SqlHelper.GetConnection();
        var dataAdapter = new SqlDataAdapter(selectCommandText, connection);
        var builder = new SqlCommandBuilder(dataAdapter);
        dataAdapter.DeleteCommand = builder.GetDeleteCommand();
        DataSet dataSet = SqlHelper.GetDataSetBySqlCommand(selectCommandText, connection);

        string studentID = (gridStudent.Rows[e.RowIndex].Cells[1].Controls[0] as TextBox).Text;
        string name = (gridStudent.Rows[e.RowIndex].Cells[2].Controls[0] as TextBox).Text;
        string gender = (gridStudent.Rows[e.RowIndex].Cells[3].Controls[0] as TextBox).Text;
        string dayOfBirth = (gridStudent.Rows[e.RowIndex].Cells[4].Controls[0] as TextBox).Text;
        string address = (gridStudent.Rows[e.RowIndex].Cells[5].Controls[0] as TextBox).Text;
        string department = (gridStudent.Rows[e.RowIndex].Cells[6].Controls[0] as TextBox).Text;

        //获取 DataSet 中与点击了 “编辑” 按钮的这行对应的数据行
        DataRow row = dataSet.Tables[0].Rows[e.RowIndex];
        //修改其中各字段的值
        row["StudentID"] = studentID;
        row["Name"] = name;
        row["Gender"] = gender;
        row["DayOfBirth"] = dayOfBirth;
        row["Address"] = address;
        row["Department"] = department;

        //提交到数据库中
        dataAdapter.Update(dataSet);
        gridStudent.EditIndex = -1;
        ShowData();
    }
示例#26
0
    protected void UserAccounts_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        Guid id = (Guid)e.Keys[0];
        GridViewRow row = UserAccounts.Rows[e.RowIndex];
        string fullname = (row.FindControl("txtFullname") as TextBox).Text;
        string email = (row.FindControl("txtEmail") as TextBox).Text;
        string phone = (row.FindControl("txtPhone") as TextBox).Text;
        string comment = (row.FindControl("txtComment") as TextBox).Text;

        bool isApproved = (row.FindControl("chkIsApproved") as CheckBox).Checked;

        MembershipUser user = Membership.GetUser(id);

        if (user == null) return;

        user.Email = email;
        user.Comment = comment;
        user.IsApproved = isApproved;

        Membership.UpdateUser(user);

        aspnet_UserProfilesBLL bll = new aspnet_UserProfilesBLL();
        bll.UpdateProfile(user.UserName, fullname, phone);

        //LinqDataSource1.DataBind();
    }
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        GridViewRow gvr = this.GridView1.Rows[this.GridView1.EditIndex];
        DropDownList ddl = (DropDownList)gvr.Cells[9].FindControl("DropDownList1");

        e.NewValues["Type"] = ddl.SelectedValue;
    }
示例#28
0
 protected void gridViewFarms_RowUpdating(object sender,
     GridViewUpdateEventArgs e)
 {
     GridViewRow row = gridViewFarms.Rows[e.RowIndex];
     try
     {
         sqlConnection.Open();
         SqlCommand cmd = sqlConnection.CreateCommand();
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.CommandText = "UpdateNotes";
         cmd.Parameters.Add("@VillageCoordinates", SqlDbType.Int).Value = ((TextBox) row.Cells[0].Controls[0]).Text;
         cmd.Parameters.Add("@Notes", SqlDbType.NVarChar).Value = ((TextBox) row.Cells[7].Controls[0]).Text;
         cmd.ExecuteNonQuery();
     }
     catch (SqlException ex)
     {
         LabelStatus.Text = ex.ToString();
     }
     finally
     {
         sqlConnection.Close();
     }
     gridViewFarms.EditIndex = -1;
     PopulateGridView();
 }
示例#29
0
 protected void AdminDoctorView_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     BusinessLayer businessLyerObj = new BusinessLayer();
     string connectString = ConfigurationManager.AppSettings.Get("connString");
     int index = e.RowIndex;
     businessLyerObj.ApproveDoctor(AdminDoctorView.DataKeys[index].Value.ToString(), connectString);
 }
    protected void gridViewIssueMaintenance_OnRowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        // Check for New Row
        if (Convert.ToString(e.Keys["IssueID"]) == "")
        {
            // --------------- //
            // Transfer Values //
            // --------------- //

            // Issue
            if (e.NewValues["Issue"] != null) { hiddenFieldIssue.Value = Convert.ToString(e.NewValues["Issue"].ToString()); };

            // IssueDescription
            if (e.NewValues["IssueDescription"] != null) { hiddenFieldIssueDescription.Value = Convert.ToString(e.NewValues["IssueDescription"].ToString()); };

            // IssueLevelID
            if (e.NewValues["IssueLevelID"] != null) { hiddenFieldIssueLevelID.Value = Convert.ToString(e.NewValues["IssueLevelID"].ToString()); };

            // IssueStatusID
            if (e.NewValues["IssueStatusID"] != null) { hiddenFieldIssueStatusID.Value = Convert.ToString(e.NewValues["IssueStatusID"].ToString()); };

            // Notes
            if (e.NewValues["Notes"] != null) { hiddenFieldNotes.Value = Convert.ToString(e.NewValues["Notes"].ToString()); };

            // New Row - Insert
            objectDataSourceIssue.Insert();

            // Reload Page
            Response.Redirect(Request.RawUrl);
        }
    }
示例#31
0
 protected void datagridview_RowUpdate(object sender, GridViewUpdateEventArgs e)
 {
     // this is important
 }
示例#32
0
 protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
 }
示例#33
0
        protected void gvReal_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            HtmlInputHidden key = (HtmlInputHidden)gvReal.Rows[e.RowIndex].Cells[0].FindControl("realid");

            string sID       = key.Value;
            string sCode     = ((TextBox)(gvReal.Rows[e.RowIndex].Cells[2].Controls[0])).Text.ToString().Trim();
            string sDesc     = ((TextBox)(gvReal.Rows[e.RowIndex].Cells[3].Controls[0])).Text.ToString().Trim();
            string sEngunit  = ((TextBox)(gvReal.Rows[e.RowIndex].Cells[4].Controls[0])).Text.ToString().Trim();
            string sMax      = ((TextBox)(gvReal.Rows[e.RowIndex].Cells[5].Controls[0])).Text.ToString().Trim();
            string sMin      = ((TextBox)(gvReal.Rows[e.RowIndex].Cells[6].Controls[0])).Text.ToString().Trim();
            string sSnapshot = ((DropDownList)(gvReal.Rows[e.RowIndex].Cells[7].FindControl("ddlSnapshot"))).SelectedValue;
            string sSort     = ((DropDownList)(gvReal.Rows[e.RowIndex].Cells[8].FindControl("ddlSort"))).SelectedValue;
            string sDisplay  = ((DropDownList)(gvReal.Rows[e.RowIndex].Cells[9].FindControl("ddlDisplay"))).SelectedValue;
            string sXYZ      = ((DropDownList)(gvReal.Rows[e.RowIndex].Cells[10].FindControl("ddlXYZ"))).SelectedValue;
            string sNote     = ((TextBox)(gvReal.Rows[e.RowIndex].Cells[11].Controls[0])).Text.ToString().Trim();

            string msg = "";

            if (sCode == "")
            {
                msg += "名称不能为空!\r\n";
            }

            //判断double格式
            if (sMax != "" && !Regex.IsMatch(sMax, @"^\d*[.]?\d*$"))
            {
                msg += "最值只能为空或数字组成!\r\n";
            }

            //判断double格式
            if (sMin != "" && !Regex.IsMatch(sMin, @"^\d*[.]?\d*$"))
            {
                msg += "最值只能为空或数字组成!\r\n";
            }

            if (msg != "")
            {
                MessageBox.popupClientMessage(this.Page, msg);
                return;
            }

            //代码是否重复
            if (KPI_RealTagDal.CodeExist(sCode, sID) || ALLDal.CodeExist(sCode, sID))
            {
                MessageBox.popupClientMessage(this.Page, "已存在相同的标签!");
                return;
            }

            //更新
            KPI_RealTagEntity ote = new KPI_RealTagEntity();

            ote.RealID      = sID;
            ote.RealCode    = sCode;
            ote.RealDesc    = sDesc;
            ote.RealEngunit = sEngunit;
            if (sMax != "")
            {
                ote.RealMaxValue = decimal.Parse(sMax);
            }
            if (sMin != "")
            {
                ote.RealMinValue = decimal.Parse(sMin);
            }
            ote.RealSnapshot = sSnapshot;
            ote.RealSort     = sSort;
            //if (sDisplay == "0")
            ote.RealDisplay    = sDisplay;
            ote.RealXYZ        = sXYZ;
            ote.RealNote       = sNote;
            ote.RealModifyTime = DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");

            if (KPI_RealTagDal.Update(ote))
            {
                MessageBox.popupClientMessage(this.Page, "编辑成功!", "call();");
            }
            else
            {
                MessageBox.popupClientMessage(this.Page, "编辑错误!", "call();");
            }

            gvReal.EditIndex = -1;

            BindReal();
        }
示例#34
0
        protected void BooksGrid_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row             = (GridViewRow)BooksGrid.Rows[e.RowIndex];
            TextBox     textName        = (TextBox)row.Cells[1].Controls[0];
            TextBox     textAuthor      = (TextBox)row.Cells[2].Controls[0];
            TextBox     textPublishYear = (TextBox)row.Cells[3].Controls[0];
            TextBox     textGenre       = (TextBox)row.Cells[4].Controls[0];
            TextBox     textDescription = (TextBox)row.Cells[5].Controls[0];

            string name, author, publishYear, genre, description;
            string BookID = ViewState["BookID"].ToString();

            name        = textName.Text;
            author      = textAuthor.Text;
            publishYear = textPublishYear.Text;
            genre       = textGenre.Text;
            description = textDescription.Text;



            BooksGrid.EditIndex = -1;


            SqlCommand cmdUpdtBooks = new SqlCommand("UPDATE DS_Library.[dbo].Books SET Title = @Name, Author = @Author, [Publish year] = @PublishYear,  Genre = @Genre , Description = @Description WHERE BookID = @BookID;", conn);

            cmdUpdtBooks.Parameters.Add("@BookID", System.Data.SqlDbType.Int);
            cmdUpdtBooks.Parameters["@BookID"].Value = Convert.ToInt32(BookID);



            cmdUpdtBooks.Parameters.Add("@Name", System.Data.SqlDbType.VarChar);
            cmdUpdtBooks.Parameters["@Name"].Value = name;

            cmdUpdtBooks.Parameters.Add("@Author", System.Data.SqlDbType.VarChar);
            cmdUpdtBooks.Parameters["@Author"].Value = author;


            cmdUpdtBooks.Parameters.Add("@PublishYear", System.Data.SqlDbType.Int);
            cmdUpdtBooks.Parameters["@PublishYear"].Value = Convert.ToInt32(publishYear);

            cmdUpdtBooks.Parameters.Add("@Genre", System.Data.SqlDbType.VarChar);
            cmdUpdtBooks.Parameters["@Genre"].Value = genre;

            cmdUpdtBooks.Parameters.Add("@Description", System.Data.SqlDbType.VarChar);
            cmdUpdtBooks.Parameters["@Description"].Value = description;

            BooksGrid.EditIndex = -1;
            try
            {
                conn.Open();
                // Label1.Text = "Reached Before.";
                cmdUpdtBooks.ExecuteNonQuery();
                // Label1.Text += "Reached After";
            }
            finally
            {
                conn.Close();
            }

            WarningLabel.Visible = false;

            BindDetails();
        }
    protected void gv_schemesteps_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        try
        {
            ArrayList data = new ArrayList();
            GridViewRow row = gv_schemesteps.Rows[e.RowIndex];
            for (int i = 1; i < gv_schemesteps.Columns.Count-1; i++)
            {
                TableCell cell = row.Controls[i] as TableCell;
                if (cell.Controls[0] is TextBox)
                {
                    TextBox box = cell.Controls[0] as TextBox;
                    data.Add(box.Text);
                }
                else if (cell.Controls[0] is HyperLink)
                {
                    HyperLink hl = cell.Controls[0] as HyperLink;
                    data.Add(hl.Text);
                }
                else if (cell.Controls[0] is CheckBox)
                {
                    CheckBox chk = cell.Controls[0] as CheckBox;
                    data.Add(chk.Checked.ToString());
                }
            }

            String uqry = "UPDATE db_performancereportstep SET recurring=@recurring, recur=@recur, num_weeks=@num_weeks WHERE step_id=@step_id";
            SQL.Update(uqry,
                new String[] { "@recurring", "@recur", "@num_weeks", "@step_id" },
                new Object[] { data[5].ToString().Replace("True","1").Replace("False","0"),
                    data[6].ToString(),
                    data[7].ToString(),
                    data[0].ToString()
                });

            // In case of duration changes, update all steps from updated point
            String qry = "SELECT * FROM db_performancereportstep, db_performancereportscheme " +
            "WHERE db_performancereportscheme.scheme_id = db_performancereportstep.scheme_id " +
            "AND db_performancereportscheme.scheme_id=@scheme_id " +
            "AND office=@office AND step_id >= @step_id " +
            "ORDER BY step_no";
            DataTable steps = SQL.SelectDataTable(qry,
                new String[] { "@office", "@step_id", "@scheme_id" },
                new Object[] { dd_office.SelectedItem.Text, data[0].ToString(), dd_schemes.SelectedItem.Value });

            if (steps.Rows.Count > 0)
            {
                DateTime last_start_date = Convert.ToDateTime(steps.Rows[0][3]);
                for (int i = 0; i < steps.Rows.Count; i++)
                {
                    bool recurring = Convert.ToBoolean(steps.Rows[i][6]);
                    int recur = Convert.ToInt32(steps.Rows[i][8])+1;
                    int num_weeks = Convert.ToInt32(steps.Rows[i][4]);
                    int duration_weeks = num_weeks;
                    DateTime start_date = Convert.ToDateTime(steps.Rows[i][3]);
                    DateTime next_start_date = start_date;

                    if (recurring) { duration_weeks = num_weeks * recur; }
                    int complete = 0;
                    if (DateTime.Now > next_start_date.AddDays(duration_weeks * 7)) { complete = 1; }

                    uqry = "UPDATE db_performancereportstep SET duration_weeks=@dw, complete=@c WHERE step_id=@s_id";
                    SQL.Update(uqry,
                        new String[] { "@dw", "@c", "@s_id" },
                        new Object[] { duration_weeks, complete, steps.Rows[i][0].ToString() });

                    if (i != (steps.Rows.Count - 1))
                    {
                        next_start_date = last_start_date.AddDays(duration_weeks * 7);
                        uqry = "UPDATE db_performancereportstep SET start_date=@sd WHERE step_id=@s_id";
                        SQL.Update(uqry,
                            new String[] { "@sd", "@s_id" },
                            new Object[] { next_start_date.ToString("yyyy/MM/dd"), steps.Rows[i + 1][0].ToString()});
                        last_start_date = next_start_date;
                    }
                    else
                    {
                        String active = "1";
                        if (complete == 1) { active = "0"; }
                        uqry = "UPDATE db_performancereportscheme SET active=@active WHERE scheme_id=@s_id";
                        SQL.Update(uqry,
                            new String[] { "@active", "@s_id" },
                            new Object[] { active, steps.Rows[i][1].ToString() });
                    }
                }
            }
        }
        catch (Exception r)
        {
            Util.Debug(r.Message + "  " + r.StackTrace + " " + r.InnerException);
            Util.PageMessage(this, "Error updating record. Make sure you are entering the correct data in each field. Dates should be formatted: dd/MM/yy.");
        }
        gv_schemesteps.EditIndex = -1;
        BindData(null, null);
    }
    protected void gv_schemes_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        try
        {
            ArrayList data = new ArrayList();
            GridViewRow row = gv_schemes.Rows[e.RowIndex];
            for (int i = 1; i < gv_schemes.Columns.Count; i++)
            {
                TableCell cell = row.Controls[i] as TableCell;
                if (cell.Controls[0] is TextBox)
                {
                    TextBox box = cell.Controls[0] as TextBox;
                    data.Add(box.Text);
                }
            }

            if (data[2].ToString() != "")
            {
                // Handle date
                DateTime entryDate = Convert.ToDateTime(data[2]);
                data[2] = entryDate.ToString("yyyy/MM/dd");

                String uqry = "UPDATE db_performancereportscheme SET " +
                "scheme_name=@scheme_name, " +
                "start_date=@start_date, " +
                "step_s=@s, " +
                "step_p=@p, " +
                "step_a=@a, " +
                "step_rev=@rev " +
                "WHERE scheme_id=@scheme_id";
                SQL.Update(uqry,
                    new String[] { "@scheme_name", "@start_date", "@s", "@p", "@a", "@rev", "@scheme_id" },
                    new Object[] { data[1].ToString(),
                        data[2].ToString(),
                        data[4].ToString(),
                        data[5].ToString(),
                        data[6].ToString(),
                        data[7].ToString(),
                        data[0].ToString()
                    });

                // In case of start_date change, update all steps 
                String qry = "SELECT * FROM db_performancereportstep, db_performancereportscheme " +
                "WHERE db_performancereportscheme.scheme_id = db_performancereportstep.scheme_id " +
                "AND db_performancereportscheme.scheme_id=@scheme_id " + 
                "AND office=@office";
                DataTable steps = SQL.SelectDataTable(qry,
                    new String[] { "@scheme_id", "@office" },
                    new Object[] { dd_schemes.SelectedItem.Value, dd_office.SelectedItem.Text });

                if (steps.Rows.Count > 0 && steps.Rows[0][3].ToString() != entryDate.ToString())
                {
                    DateTime new_start_date = entryDate;
                    for (int i = 0; i < steps.Rows.Count; i++)
                    { 
                        if (i != 0) 
                        { 
                            int weeks = Convert.ToInt32(steps.Rows[i-1][5]);
                            new_start_date = new_start_date.AddDays(weeks * 7);
                        }

                        int complete = 0;
                        int duration = Convert.ToInt32(steps.Rows[i][5]);
                        if (DateTime.Now > new_start_date.AddDays(duration*7)) { complete = 1; }

                        uqry = "UPDATE db_performancereportstep SET " +
                        "start_date=@start_date, " +
                        "complete=@complete " +
                        "WHERE step_id=@step_id";
                        SQL.Update(uqry,
                            new String[] { "@start_date", "@complete", "@step_id" },
                            new Object[] { new_start_date.ToString("yyyy/MM/dd"),
                                complete,
                                steps.Rows[i][0]
                            });

                        
                        if (i == (steps.Rows.Count - 1))
                        {
                            String active = "1";
                            if (complete == 1) { active = "0"; }

                            uqry = "UPDATE db_performancereportscheme SET active=@active WHERE scheme_id=@scheme_id";
                            SQL.Update(uqry, new String[] { "@active", "@scheme_id" }, new Object[] { active, steps.Rows[i][1] });
                        }
                    }
                }
            }
            else
            {
                Util.PageMessage(this, "You must enter a start date for this scheme.");
            }
        }
        catch (Exception)
        {
            Util.PageMessage(this, "Error updating record. Make sure you are entering the correct data in each field. Dates should be formatted: dd/MM/yy.");
        }
        gv_schemes.EditIndex = -1;
        BindData(null, null);
    }
 protected void grid_carcolor_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
 }
示例#38
0
        protected void gvReviews_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            int rowIndex = e.RowIndex;
            int ReviewID = int.Parse(gvReviews.Rows[rowIndex].Cells[0].Text);

            TextBox TBox;
            //TBox = (TextBox)gvReviews.Rows[rowIndex].Cells[2].Controls[0];
            //int FoodRating = int.Parse(TBox.Text);

            //TBox = (TextBox)gvReviews.Rows[rowIndex].Cells[3].Controls[0];
            //int ServiceRating = int.Parse(TBox.Text);

            //TBox = (TextBox)gvReviews.Rows[rowIndex].Cells[4].Controls[0];
            //int PriceRating = int.Parse(TBox.Text);

            //TBox = (TextBox)gvReviews.Rows[rowIndex].Cells[5].Controls[0];
            //String ReviewComment = TBox.Text.ToString();

            int foodrating;
            int servicerating;
            int pricerating;

            TBox = (TextBox)gvReviews.Rows[rowIndex].Cells[2].Controls[0];
            bool res = int.TryParse(TBox.Text, out foodrating);

            TBox = (TextBox)gvReviews.Rows[rowIndex].Cells[3].Controls[0];
            bool res1 = int.TryParse(TBox.Text, out servicerating);

            TBox = (TextBox)gvReviews.Rows[rowIndex].Cells[4].Controls[0];
            bool res2 = int.TryParse(TBox.Text, out pricerating);

            TBox = (TextBox)gvReviews.Rows[rowIndex].Cells[5].Controls[0];
            String ReviewComment = TBox.Text.ToString();

            if (res == false || res1 == false || res2 == false)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "MessageBox", "alert('Please enter a valid number for the Ratings');", true);
            }
            else
            {
                if (foodrating > 5 || foodrating < 1 || servicerating > 5 || servicerating < 1 || pricerating > 5 || pricerating < 1)
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "MessageBox", "alert('Please enter a number from 1-5 for the Ratings');", true);
                }
                else
                {
                    SqlCommand objCommand = new SqlCommand();
                    objCommand.CommandType = CommandType.StoredProcedure;
                    objCommand.CommandText = "UpdateReview";

                    objCommand.Parameters.AddWithValue("@ReviewID", ReviewID);
                    objCommand.Parameters.AddWithValue("@ChangedFoodRating", foodrating);
                    objCommand.Parameters.AddWithValue("@ChangedServiceRating", servicerating);
                    objCommand.Parameters.AddWithValue("@ChangedPriceRating", pricerating);
                    objCommand.Parameters.AddWithValue("@ChangedReviewComment", ReviewComment);

                    DBConnect objDB = new DBConnect();
                    objDB.DoUpdateUsingCmdObj(objCommand);

                    gvReviews.EditIndex = -1;

                    //Rebind GV
                    SqlCommand objCommand2 = new SqlCommand();
                    objCommand2.CommandType = CommandType.StoredProcedure;
                    objCommand2.CommandText = "GetReviewByAccountID";

                    objCommand2.Parameters.AddWithValue("@AccountID", AccountID);

                    DBConnect objDB2     = new DBConnect();
                    DataSet   myDataSet2 = objDB2.GetDataSetUsingCmdObj(objCommand2);

                    gvReviews.DataSource = myDataSet2;
                    gvReviews.DataBind();
                }
            }
        }
示例#39
0
        protected void GridView_Update(object sender, GridViewUpdateEventArgs e)
        {
            string userId = userGrid.DataKeys[e.RowIndex].Values[0].ToString();

            if (!FooStringHelper.IsValidAlphanumeric(userId, 16))
            {
                errorLabel.Text = "Invalid request.";
                Reset_Page();
                return;
            }

            var txtUserName   = (TextBox)userGrid.Rows[e.RowIndex].FindControl("txtUserName");
            var txtUserAlias  = (TextBox)userGrid.Rows[e.RowIndex].FindControl("txtUserAlias");
            var txtEmail      = (TextBox)userGrid.Rows[e.RowIndex].FindControl("txtEmail");
            var groupDropdown = (DropDownList)userGrid.Rows[e.RowIndex].FindControl("groupDropdown");

            if (!string.IsNullOrEmpty(txtUserName.Text) && !string.IsNullOrEmpty(txtUserAlias.Text) &&
                !string.IsNullOrEmpty(txtEmail.Text) && FooStringHelper.IsValidEmailAddress(txtEmail.Text))
            {
                try
                {
                    if (FooSessionHelper.IsValidRequest(HttpContext.Current, RequestToken.Value))
                    {
                        using (var conn = new NpgsqlConnection())
                        {
                            conn.ConnectionString =
                                ConfigurationManager.ConnectionStrings["fooPostgreSQL"].ConnectionString;
                            conn.Open();

                            var cmd = new NpgsqlCommand
                            {
                                CommandText =
                                    "UPDATE users SET (username, useralias, groupid, email) = (@NAME, @USERALIAS, @GROUP, @EMAIL) WHERE userID= @USERID",
                                CommandType = CommandType.Text,
                                Connection  = conn
                            };

                            var param = new NpgsqlParameter
                            {
                                ParameterName = "@USERID",
                                NpgsqlDbType  = NpgsqlDbType.Varchar,
                                Size          = 16,
                                Direction     = ParameterDirection.Input,
                                Value         = userId
                            };
                            cmd.Parameters.Add(param);

                            var nameParam = new NpgsqlParameter
                            {
                                ParameterName = "@USERNAME",
                                NpgsqlDbType  = NpgsqlDbType.Varchar,
                                Size          = 32,
                                Direction     = ParameterDirection.Input,
                                Value         = txtUserName.Text
                            };
                            cmd.Parameters.Add(nameParam);

                            var dispParam = new NpgsqlParameter
                            {
                                ParameterName = "@USERALIAS",
                                NpgsqlDbType  = NpgsqlDbType.Varchar,
                                Size          = 32,
                                Direction     = ParameterDirection.Input,
                                Value         = txtUserAlias.Text
                            };
                            cmd.Parameters.Add(dispParam);

                            var emailParam = new NpgsqlParameter
                            {
                                ParameterName = "@EMAIL",
                                NpgsqlDbType  = NpgsqlDbType.Varchar,
                                Size          = 64,
                                Direction     = ParameterDirection.Input,
                                Value         = txtEmail.Text
                            };
                            cmd.Parameters.Add(emailParam);

                            var groupParam = new NpgsqlParameter
                            {
                                ParameterName = "@GROUP",
                                NpgsqlDbType  = NpgsqlDbType.Varchar,
                                Size          = 16,
                                Direction     = ParameterDirection.Input,
                                Value         = groupDropdown.SelectedValue
                            };
                            cmd.Parameters.Add(groupParam);

                            cmd.ExecuteNonQuery();
                        }
                    }

                    else
                    {
                        errorLabel.Text = "Invalid request.";
                    }
                }
                catch (Exception ex)
                {
                    FooLogging.WriteLog(ex.ToString());
                    errorLabel.Text = "Something has gone wrong. A log has been forwarded to the site administrator.";
                }
            }
            else
            {
                errorLabel.Text = "Incomplete or invalid input.";
            }

            Reset_Page();
        }
 protected void dgTransportMaster_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
 }
 protected void listaUsuarios_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     Debug.WriteLine("RowUpdating chamado");
 }
示例#42
0
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        try
        {
            int dk = Convert.ToInt32(GridView1.DataKeys[GridView1.EditIndex].Value);


            TextBox cat = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtCategory1");

            DropDownList wh = (DropDownList)GridView1.Rows[GridView1.EditIndex].FindControl("ddlBusiness1");

            CheckBox cb = (CheckBox)GridView1.Rows[e.RowIndex].FindControl("cbxStatus1");

            //string str1 = "SELECT * from JobFunctionCategory  where CategoryName ='" + cat.Text + "' and Whid='" + wh.SelectedValue + "' and Id<>'" + dk + "'";
            //SqlCommand cmd1 = new SqlCommand(str1, con);
            //SqlDataAdapter da1 = new SqlDataAdapter(cmd1);
            //DataTable dt1 = new DataTable();
            //da1.Fill(dt1);
            CLS_JobFunctionCategory jfc = new CLS_JobFunctionCategory();
            jfc.Whid         = wh.SelectedValue;
            jfc.CategoryName = cat.Text;
            jfc.Id           = dk.ToString();

            DataTable dt1 = jfc.cls_jobfunctioncategory5();

            if (dt1.Rows.Count > 0)
            {
                lblmsg.Visible = true;
                lblmsg.Text    = "Category already exist";
            }

            else
            {
                int i;
                if (cb.Checked == true)
                {
                    i = 1;
                }
                else
                {
                    i = 0;
                }

                string     sr51   = ("update JobFunctionCategory set CategoryName ='" + cat.Text + "',Whid='" + wh.SelectedValue + "',Status = " + i + " where Id='" + dk + "' ");
                SqlCommand cmd801 = new SqlCommand(sr51, con);

                if (con.State.ToString() != "Open")
                {
                    con.Open();
                }
                cmd801.ExecuteNonQuery();
                con.Close();
                //jfc.Whid = wh.SelectedValue;
                //jfc.CategoryName = cat.Text;
                //jfc.Id = dk.ToString();
                //jfc.cls_update_jobfunction();

                GridView1.EditIndex = -1;
                fillgrid();
                lblmsg.Visible = true;
                lblmsg.Text    = "Record updated successfully";
                //ddl();
            }
        }
        catch (Exception ert)
        {
            lblmsg.Visible = true;
            lblmsg.Text    = "Error :" + ert.Message;
        }
    }
示例#43
0
    protected void gvSeniorityRecords_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        try
        {
            lblmsg.Text = "";
            int      CrewID = UDFLib.ConvertToInteger(gvSeniorityRecords.DataKeys[e.RowIndex].Values[0].ToString());
            int      CompanySeniorityYear     = UDFLib.ConvertToInteger(gvSeniorityRecords.DataKeys[e.RowIndex].Values[1].ToString());
            int      CompanySeniorityDays     = UDFLib.ConvertToInteger(gvSeniorityRecords.DataKeys[e.RowIndex].Values[2].ToString());
            int      CompanySeniorityYear_New = UDFLib.ConvertToInteger(e.NewValues["CompanySeniorityYear"]);
            int      CompanySeniorityDays_New = UDFLib.ConvertToInteger(e.NewValues["CompanySeniorityDays"]);
            string   Remarks = "Updating Company Seniority first time for existing crews";
            DateTime CompanyEffectiveDate_New;

            if ((CompanySeniorityYear_New > 0 || CompanySeniorityDays_New > 0) && (CompanySeniorityYear != CompanySeniorityYear_New || CompanySeniorityDays != CompanySeniorityDays_New))
            {
                if (CompanySeniorityDays_New > 364)
                {
                    lblmsg.Text = "Company Seniority Days cannot be greater than 364";
                }
                if (e.NewValues["CompanyEffective_date"] != null)
                {
                    CompanyEffectiveDate_New = UDFLib.ConvertToDate(Convert.ToString(e.NewValues["CompanyEffective_date"]), UDFLib.GetDateFormat());

                    BLL_PortageBill.Update_CrewCompanySeniority(CrewID, CompanySeniorityYear_New, CompanySeniorityDays_New, Remarks, CompanyEffectiveDate_New, Convert.ToInt32(Session["userid"]));
                }
                else
                {
                    lblmsg.Text = "Company Effective Date is mandatory to update Company Seniority";
                }
            }

            int RankSeniorityYear = UDFLib.ConvertToInteger(gvSeniorityRecords.DataKeys[e.RowIndex].Values[3].ToString());
            int RankSeniorityDays = UDFLib.ConvertToInteger(gvSeniorityRecords.DataKeys[e.RowIndex].Values[4].ToString());

            int RankSeniorityYear_New = UDFLib.ConvertToInteger(e.NewValues["RankSeniorityYear"]);
            int RankSeniorityDays_New = UDFLib.ConvertToInteger(e.NewValues["RankSeniorityDays"]);

            Remarks = "Updating Rank Seniority first time for existing crews";

            if ((RankSeniorityYear_New > 0 || RankSeniorityDays_New > 0) && (RankSeniorityYear != RankSeniorityYear_New || RankSeniorityDays != RankSeniorityDays_New))
            {
                GridViewRow row     = (GridViewRow)gvSeniorityRecords.Rows[e.RowIndex];
                int         RankId1 = int.Parse(((DropDownList)row.FindControl("ddlSeniorityRank")).SelectedValue.ToString());

                if (RankSeniorityDays_New > 364)
                {
                    lblmsg.Text = "Rank Seniority Days cannot be greater than 364";
                }
                if (e.NewValues["RankEffective_date"] != null)
                {
                    BLL_PortageBill.Update_CrewRankSeniority(CrewID, RankId1, RankSeniorityYear_New, RankSeniorityDays_New, 0, Remarks, UDFLib.ConvertToDate(e.NewValues["RankEffective_date"].ToString(), UDFLib.GetDateFormat()), Convert.ToInt32(Session["userid"]));
                }
                else
                {
                    lblmsg.Text = "Rank Effective Date is mandatory to update Rank Seniority";
                }
            }
            if (lblmsg.Text.Trim() == "")
            {
                lblmsg.Visible = false;
                gvSeniorityRecords.EditIndex = -1;
                Load_SeniorityRecords();
            }
            else
            {
                lblmsg.Visible = true;
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
示例#44
0
 protected void egvShowPictures_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     Response.Redirect(GlobalSettings.RelativeWebRoot + "controlpanel/controlpanel.aspx?site-showpictureadd&ID=" + egvShowPictures.DataKeys[e.RowIndex].Value);
 }
示例#45
0
        protected void gv_PSF_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            try
            {
                DataSet ds_update = new DataSet();

                TextBox txtLetterSentDate = (TextBox)grdNextDueMaintenance.Rows[e.RowIndex].FindControl("txtLetterSentDate");
                TextBox txtCallDate       = (TextBox)grdNextDueMaintenance.Rows[e.RowIndex].FindControl("txtCallDate");
                TextBox txtSmsDate        = (TextBox)grdNextDueMaintenance.Rows[e.RowIndex].FindControl("txtSmsDate");
                TextBox txtRemarks        = (TextBox)grdNextDueMaintenance.Rows[e.RowIndex].FindControl("txtRemarks");


                Label JobCode = (Label)grdNextDueMaintenance.Rows[e.RowIndex].FindControl("lblJobCode");


                ds_update = (DataSet)Session["NextDueMaintenance"];

                //Uzair
                foreach (DataRow dr in ds_update.Tables[0].Rows)
                {
                    if (dr["JobCardCode"].ToString().Trim() == JobCode.Text.Trim())
                    {
                        dr["LetterSentDate"] = sysFunc.SaveDate(txtLetterSentDate.Text);

                        if (txtCallDate.Text == "")
                        {
                            dr["CalledDate10Day"] = null;
                        }
                        else
                        {
                            dr["CalledDate10Day"] = sysFunc.SaveDate(txtCallDate.Text);
                        }
                        if (txtSmsDate.Text == "")
                        {
                            dr["SMSSendDate"] = null;
                        }
                        else
                        {
                            dr["SMSSendDate"] = sysFunc.SaveDate(txtSmsDate.Text);
                        }
                        dr["Remarks2Day"] = txtRemarks.Text.Trim();
                    }
                }

                grdNextDueMaintenance.EditIndex = -1;

                grdNextDueMaintenance.DataSource = ds_update;
                grdNextDueMaintenance.DataBind();

                SqlParameter[] param =
                {
                    new SqlParameter("@DealerCode",      SqlDbType.Char,      5),
                    new SqlParameter("@JObCardCode",     SqlDbType.Char,      8),
                    new SqlParameter("@LetterSentDate",  SqlDbType.DateTime),
                    new SqlParameter("@CalledDate10Day", SqlDbType.DateTime),
                    new SqlParameter("@SMSSendDate",     SqlDbType.DateTime),
                    new SqlParameter("@Remarks2Day",     SqlDbType.VarChar, 50)
                };

                param[0].Value = Session["DealerCode"].ToString();
                param[1].Value = JobCode.Text;
                if (txtLetterSentDate.Text == "")
                {
                    param[2].Value = null;
                }
                else
                {
                    param[2].Value = sysFunc.SaveDate(txtLetterSentDate.Text);
                }
                if (txtCallDate.Text == "")
                {
                    param[3].Value = null;
                }
                else
                {
                    param[3].Value = sysFunc.SaveDate(txtCallDate.Text);
                }
                if (txtSmsDate.Text == "")
                {
                    param[4].Value = null;
                }
                else
                {
                    param[4].Value = sysFunc.SaveDate(txtSmsDate.Text);
                }

                param[5].Value = txtRemarks.Text.Trim();

                if (ObjTrans.BeginTransaction(ref Trans) == true)
                {
                    myFunc.ExecuteSP_NonQuery("[sp_SP_CRM_PostSales_NextDueMaintenance_Update]", param, Trans);
                    //string sql = "update CRM_PostSales_NextDueMaintenance set LetterSentDate = '" + sysFunc.SaveDate(txtLetterSentDate.Text) + "', Remarks2Day = '" + txtRemarks.Text + "' , CalledDate10Day ='" + sysFunc.SaveDate(txtCallDate.Text) + "'" +
                    //    ", SMSSendDate = '" + sysFunc.SaveDate(txtSmsDate.Text) + "' where DealerCode = '" + Session["DealerCode"].ToString() + "' and JobCardCode = '" + JobCode.Text + "' ";
                    //myFunc.ExecuteQuery(sql, Trans);
                }

                lblMessage.Visible   = true;
                lblMessage.ForeColor = Color.Green;
                lblMessage.Text      = "Record " + JobCode.Text + " Updated";

                Session["NextDueMaintenance"] = ds_update;
                ObjTrans.CommittTransaction(ref Trans);
            }
            catch (Exception ex)
            {
                //ObjTrans.CommittTransaction(ref Trans);
                ObjTrans.RollBackTransaction(ref Trans);
                lblMessage.Visible = true;
                lblMessage.Text    = ex.Message;
            }
        }
示例#46
0
 protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     GridView1.EditIndex = e.RowIndex;
     // Rebind the data
     GridView1.DataBind();
 }
 protected void grdBookDetails_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     grdBookDetails.EditIndex = -1;
     BindBookRecordGridView();
 }
示例#48
0
 protected void gdvPortalModulesLists_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
 }
 protected void gvCustomRatings_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
 }
示例#50
0
 protected void gvEmployees_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     DataTable dt = ((DataSet)ViewState["DNDS"]).Tables["Employees"];
 }
        protected void gvLoans_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            Label   Id       = gvCommittee.Rows[e.RowIndex].FindControl("lblId") as Label;
            TextBox Name     = gvCommittee.Rows[e.RowIndex].FindControl("txtName") as TextBox;
            TextBox Duration = gvCommittee.Rows[e.RowIndex].FindControl("txtGridDuration") as TextBox;
            TextBox SKU      = gvCommittee.Rows[e.RowIndex].FindControl("txtSKU") as TextBox;

            //TextBox Date = gvCommittee.Rows[e.RowIndex].FindControl("txtGridDate") as TextBox;
            //Label lblSKUProduct = gvCommittee.Rows[e.RowIndex].FindControl("lblDuration") as Label;
            if (Duration.Text.Length < 4 || Duration.Text.Length > 4)
            {
                lblmsgerror.Text = "Enter only 4 digit code";
            }
            else
            {
                lblmsgerror.Text = "";
                int r     = 0;
                int n     = Convert.ToInt32(SKU.Text);
                int left  = n;
                int rev   = 0;
                int count = 0;
                int val   = 0;
                while (left > 0)
                {
                    r = left % 10;
                    if (count > 3)
                    {
                        val = val * 10 + r;
                        //count++;
                    }
                    else
                    {
                        rev = rev * 10 + r;
                        count++;
                    }
                    left = left / 10;
                }

                left = rev;
                int updateSku = 0;
                int r1        = 0;
                while (left > 0)
                {
                    r1 = left % 10;



                    updateSku = updateSku * 10 + r1;


                    left = left / 10;
                }
                left = val;
                int updateSku1 = 0;

                while (left > 0)
                {
                    r1 = left % 10;

                    // val = val * 10 + r1;



                    updateSku1 = updateSku1 * 10 + r1;


                    left = left / 10;
                }
                p1.Text = updateSku1.ToString() + Duration.Text.ToString();
                con.Open();
                //updating the record
                SqlCommand cmd = new SqlCommand("Update Product set Name='" + Name.Text + "',Code='" + Duration.Text + "',SKU='" + p1.Text.ToString() + "' where Id=" + Convert.ToInt32(Id.Text), con);
                cmd.ExecuteNonQuery();

                con.Close();

                //Setting the EditIndex property to -1 to cancel the Edit mode in Gridview
                gvCommittee.EditIndex = -1;
                //Call ShowData method for displaying updated data
            }
            LoadLoans();
        }
示例#52
0
 protected void gridField_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
 }
示例#53
0
        protected void GrdDatos_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            Idioma = (DataTable)ViewState["TablaIdioma"];
            DataRow[] Result;
            Cnx.SelecBD();
            using (SqlConnection sqlCon = new SqlConnection(Cnx.GetConex()))
            {
                CheckBox chkbox  = GrdDatos.Rows[e.RowIndex].FindControl("CkbActivo") as CheckBox;
                int      VbAdmin = 0;
                if (chkbox.Checked == true)
                {
                    VbAdmin = 1;
                }
                sqlCon.Open();
                using (SqlTransaction Transac = sqlCon.BeginTransaction())
                {
                    string VBQuery = "EXEC SP_TablasGeneral 18,@CodUsu, '', '', @Login, @Pass,@VbC77U, '','','UPDATE',0,@Act,0,0,0,@ICC,'01-01-1','02-01-1','03-01-1'";
                    using (SqlCommand sqlCmd = new SqlCommand(VBQuery, sqlCon, Transac))
                    {
                        try
                        {
                            string Mensj  = "";
                            string borrar = GrdDatos.DataKeys[e.RowIndex].Value.ToString();
                            sqlCmd.Parameters.AddWithValue("@Login", (GrdDatos.Rows[e.RowIndex].FindControl("TxtUsu") as TextBox).Text.Trim());
                            sqlCmd.Parameters.AddWithValue("@Pass", (GrdDatos.Rows[e.RowIndex].FindControl("TxtPassW") as TextBox).Text.Trim());
                            sqlCmd.Parameters.AddWithValue("@Act", VbAdmin);
                            sqlCmd.Parameters.AddWithValue("@VbC77U", Session["C77U"].ToString());
                            sqlCmd.Parameters.AddWithValue("@CodUsu", GrdDatos.DataKeys[e.RowIndex].Value.ToString());
                            sqlCmd.Parameters.AddWithValue("@ICC", Session["!dC!@"].ToString());
                            SqlDataReader SDR = sqlCmd.ExecuteReader();
                            if (SDR.Read())
                            {
                                Mensj = HttpUtility.HtmlDecode(SDR["Mensj"].ToString().Trim());
                            }
                            SDR.Close();

                            if (!Mensj.ToString().Trim().Equals(""))
                            {
                                Result = Idioma.Select("Objeto= '" + Mensj.ToString().Trim() + "'");
                                foreach (DataRow row in Result)
                                {
                                    Mensj = row["Texto"].ToString().Trim();
                                }

                                ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('" + Mensj + "');", true);
                                Transac.Rollback();
                                return;
                            }
                            Transac.Commit();
                            GrdDatos.EditIndex = -1;
                            BindData(TxtBusqueda.Text, "UPD");
                        }
                        catch (Exception)
                        {
                            Transac.Rollback();
                            Result = Idioma.Select("Objeto= 'MensErrMod'");
                            foreach (DataRow row in Result)
                            {
                                ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('" + row["Texto"].ToString() + "');", true);
                            }                                                                                                                                       //Error en el proceso de edición')", true);
                        }
                    }
                }
            }
        }
示例#54
0
    protected void GridView3_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        lblmsg1.Text     = "";
        lblmsg1.CssClass = "reset";
        SqlConnection con = new SqlConnection(Session[Session["TMLDealercode"] + "-TMLConString"].ToString());

        try
        {
            int    catid        = int.Parse(GridView3.DataKeys[e.RowIndex].Value.ToString());
            string txtdevice    = ((TextBox)GridView3.Rows[e.RowIndex].Cells[1].Controls[1]).Text;
            string txtipaddress = ((TextBox)GridView3.Rows[e.RowIndex].Cells[2].Controls[1]).Text;
            string txtmachineid = ((TextBox)GridView3.Rows[e.RowIndex].Cells[3].Controls[1]).Text;
            string drplocname   = ((DropDownList)GridView3.Rows[e.RowIndex].Cells[4].Controls[1]).SelectedValue;
            // string chkSpeedo = ((System.Web.UI.WebControls.CheckBox)GridView3.Rows[e.RowIndex].Cells[5].Controls[1]).Checked.ToString();
            // string EmpType = ((DropDownList)GridView3.Rows[e.RowIndex].Cells[6].Controls[1]).SelectedItem.Text;
            string txtDeviceSN = ((TextBox)GridView3.Rows[e.RowIndex].Cells[5].Controls[1]).Text;
            //if (EmpType == "Select")
            //{
            //    EmpType = "";
            //}

            SqlCommand cmd = new SqlCommand("udpUpdateTblDevices_BS", con);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@SlNo", catid);
            cmd.Parameters.AddWithValue("@DeviceName", txtdevice);
            cmd.Parameters.AddWithValue("@IpAddress", txtipaddress);
            cmd.Parameters.AddWithValue("@MachineId", txtmachineid);
            cmd.Parameters.AddWithValue("@LocationName", drplocname);
            //cmd.Parameters.AddWithValue("@IsSpeedoBay", chkSpeedo);
            //cmd.Parameters.AddWithValue("@EmpType", EmpType);
            cmd.Parameters.AddWithValue("@DeviceSerialNo", txtDeviceSN);
            SqlParameter msg  = cmd.Parameters.Add("@msg", SqlDbType.VarChar, 100);
            SqlParameter Flag = cmd.Parameters.Add("@Flag", SqlDbType.Int);
            msg.Direction  = ParameterDirection.Output;
            msg.Value      = "";
            Flag.Direction = ParameterDirection.Output;
            Flag.Value     = 0;
            con.Open();
            cmd.ExecuteNonQuery();
            if (Flag.Value.ToString() == "0")
            {
                lblmsg1.CssClass = "ErrMsg";
                lblmsg1.Attributes.Add("style", "text-transform:none !important");
                lblmsg1.Text = msg.Value.ToString();
                ClientScript.RegisterStartupScript(this.GetType(), "HideLabel", "<script type=\"text/javascript\">setTimeout(\"document.getElementById('" + lblmsg1.ClientID + "').style.display='none'\",5000)</script>");
            }
            else
            {
                lblmsg1.CssClass = "ScsMsg";
                lblmsg1.Attributes.Add("style", "text-transform:none !important");
                lblmsg1.Text        = msg.Value.ToString();
                GridView3.EditIndex = -1;
                ClientScript.RegisterStartupScript(this.GetType(), "HideLabel", "<script type=\"text/javascript\">setTimeout(\"document.getElementById('" + lblmsg1.ClientID + "').style.display='none'\",5000)</script>");
                bindgridVal();
            }
        }
        catch (Exception ex)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "HideLabel", "<script type=\"text/javascript\">setTimeout(\"document.getElementById('" + lblmsg1.ClientID + "').style.display='none'\",5000)</script>");
            lblmsg1.Text     = ex.Message;
            lblmsg1.CssClass = "ErrMsg";
            lblmsg1.Attributes.Add("style", "text-transform:none !important");
        }
        finally
        {
            con.Close();
        }
    }
示例#55
0
 protected void gvNguoiDaiDienVon_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
 }
示例#56
0
 protected void gvExcel_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     getVisible(((Label)gvExcel.Rows[e.RowIndex].Cells[0].FindControl("Label2")).Text, ((Label)gvExcel.Rows[e.RowIndex].Cells[0].FindControl("Label1")).Text);
     gvData.DataSource = ddt;
     gvData.DataBind();
 }
示例#57
0
    protected void dctGRIDVIEW2_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        DateTime currentTime = DateTime.Now;
        DateTime endDate     = DateTime.Today.AddDays(90);

        foreach (DateTime day in EachDay(currentTime, endDate))
        {
            if (IsWeekend(day))
            {
                string insertweekend;
                String selectsql;
                selectsql  = " select slot1 ";
                selectsql += " from tempdentistslot ";
                selectsql += "WHERE appdate = :day and dentist_id=:dentistid";// +Convert.ToDateTime(day) + "'";
                OracleConnection incon = new OracleConnection(connectionString);
                OracleCommand    cmd1  = new OracleCommand(selectsql, incon);
                cmd1.Parameters.Add(":day", day);
                cmd1.Parameters.Add(":dentistid", Int64.Parse(GridView2.Rows[e.RowIndex].Cells[2].Text));
                incon.Open();
                OracleDataReader readerchk;
                try
                {
                    readerchk = cmd1.ExecuteReader();
                    readerchk.Read();
                    if (!readerchk.HasRows)
                    {
                        insertweekend  = "INSERT INTO tempDentistSlot (";
                        insertweekend += "dentist_id, appdate, slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8, vaction ) ";
                        insertweekend += "VALUES (";
                        insertweekend += ":dentist_id, :appdate, :slot1,:slot2, :slot3, :slot4, :slot5, :slot6, :slot7, :slot8, :vaction)";
                        // OracleConnection incon = new OracleConnection(connectionString);
                        OracleCommand cmd2 = new OracleCommand(insertweekend, incon);
                        cmd2.Parameters.Add(":dentist_id", Int64.Parse(GridView2.Rows[e.RowIndex].Cells[2].Text));
                        cmd2.Parameters.Add(":APPDATE", Convert.ToDateTime(day.ToString()));
                        cmd2.Parameters.Add(":slot1", "w");
                        cmd2.Parameters.Add(":slot2", "w");
                        cmd2.Parameters.Add(":slot3", "w");
                        cmd2.Parameters.Add(":slot4", "w");
                        cmd2.Parameters.Add(":slot5", "w");
                        cmd2.Parameters.Add(":slot6", "w");
                        cmd2.Parameters.Add(":slot7", "w");
                        cmd2.Parameters.Add(":slot8", "w");
                        cmd2.Parameters.Add(":vaction", "");
                        cmd2.BindByName = true;
                        int added1 = 0;

                        // incon.Open();
                        added1        = cmd2.ExecuteNonQuery();
                        adderror.Text = "Update doctor vacation";
                    }
                }
                catch (Exception err)
                {
                    bdreeor.Text  = "Error inserting record. ";
                    bdreeor.Text += err.Message;
                }
                finally
                {
                    incon.Close();
                }
            }
            TextBox t      = (TextBox)GridView2.Rows[e.RowIndex].Cells[2].FindControl("strtdte");
            string  strdte = t.Text;
            //   string strdte = (GridView2.FooterRow.FindControl("startdate") as TextBox).Text;
            // string enddte = (GridView2.FooterRow.FindControl("enddate") as TextBox).Text;
            TextBox t1     = (TextBox)GridView2.Rows[e.RowIndex].Cells[2].FindControl("enddte");
            string  enddte = t1.Text;

            if (day >= Convert.ToDateTime(strdte) && day <= Convert.ToDateTime(enddte))
            {
                string INSERTSQL;
                INSERTSQL  = "INSERT INTO tempDentistSlot (";
                INSERTSQL += "dentist_id, appdate, slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8, vaction) ";
                INSERTSQL += "VALUES (";
                INSERTSQL += ":dentist_id, :appdate, :slot1, :slot2, :slot3, :slot4, :slot5, :slot6, :slot7, :slot8, :vaction )";



                OracleConnection incon = new OracleConnection(connectionString);
                OracleCommand    cmd   = new OracleCommand(INSERTSQL, incon);

                //   incon2.Open();


                cmd.Parameters.Add(":dentist_id", Int64.Parse(GridView2.Rows[e.RowIndex].Cells[2].Text));
                cmd.Parameters.Add(":APPDATE", Convert.ToDateTime(day.ToString()));
                cmd.Parameters.Add(":slot1", "v");
                cmd.Parameters.Add(":slot2", "v");
                cmd.Parameters.Add(":slot3", "v");
                cmd.Parameters.Add(":slot4", "v");
                cmd.Parameters.Add(":slot5", "v");
                cmd.Parameters.Add(":slot6", "v");
                cmd.Parameters.Add(":slot7", "v");
                cmd.Parameters.Add(":slot8", "v");
                cmd.Parameters.Add(":vaction", "v");
                cmd.BindByName = true;

                int added2 = 0;
                try
                {
                    incon.Open();
                    added2        = cmd.ExecuteNonQuery();
                    adderror.Text = "New services added";
                }
                catch (Exception err)
                {
                    bdreeor.Text  = "Error inserting record. ";
                    bdreeor.Text += err.Message;
                }
                finally
                {
                    incon.Close();
                }
            }

            else if (!IsWeekend(day))
            {
                string INSERTSQL;
                INSERTSQL  = "INSERT INTO tempDentistSlot (";
                INSERTSQL += "dentist_id, appdate, slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8, vaction) ";
                INSERTSQL += "VALUES (";
                INSERTSQL += ":dentist_id, :appdate, :slot1, :slot2, :slot3, :slot4, :slot5, :slot6, :slot7, :slot8, :vaction )";


                OracleConnection incon2 = new OracleConnection(connectionString);
                OracleCommand    cmd3   = new OracleCommand(INSERTSQL, incon2);

                //incon2.Open();


                cmd3.Parameters.Add(":dentist_id", Int64.Parse(GridView2.Rows[e.RowIndex].Cells[2].Text));
                cmd3.Parameters.Add(":APPDATE", Convert.ToDateTime(day.ToString()));
                cmd3.Parameters.Add(":slot1", "");
                cmd3.Parameters.Add(":slot2", "");
                cmd3.Parameters.Add(":slot3", "");
                cmd3.Parameters.Add(":slot4", "");
                cmd3.Parameters.Add(":slot5", "");
                cmd3.Parameters.Add(":slot6", "");
                cmd3.Parameters.Add(":slot7", "");
                cmd3.Parameters.Add(":slot8", "");
                cmd3.Parameters.Add(":vaction", "");
                cmd3.BindByName = true;

                int added1 = 0;
                try
                {
                    incon2.Open();
                    added1        = cmd3.ExecuteNonQuery();
                    adderror.Text = "New services added";
                }
                catch (Exception err)
                {
                    bdreeor.Text  = "Error inserting record. ";
                    bdreeor.Text += err.Message;
                }
                finally
                {
                    incon2.Close();
                }
            }
        }
    }
示例#58
0
 protected void GvList_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     GvHelper.DatagridSkinUpdate(e);
 }
        protected void gvAddData_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            //Page.ClientScript.RegisterStartupScript(this.GetType(), "focus", "<script>alert('" + (gvAddData.Rows[e.RowIndex].FindControl("HiddenField1") as HiddenField).Value + "')</script>");
            string D_id    = (gvAddData.Rows[e.RowIndex].FindControl("hfDetailId") as HiddenField).Value;
            string c       = "select Bill_id from pd_detail where Detail_id ='" + D_id + "'";
            string bill_id = new SelectCommandBuilder().ExecuteDataTable(c).Rows[0][0].ToString();
            string sql1    = "delete from pd_detail where Detail_id ='" + D_id + "'";
            int    count   = new DeleteCommandBuilder().ExecuteNonQuery(sql1);
            string dsql    = "SELECT COUNT(*) AS COUNTa FROM pd_detail where Bill_id = '" + bill_id + "'";
            int    p       = Convert.ToInt32(new SelectCommandBuilder().ExecuteScalar(dsql));

            if (p == 0)
            {
                string sqlc = "delete from pd where Bill_id = '" + bill_id + "'";
                count += new DeleteCommandBuilder().ExecuteNonQuery(sqlc);
            }
            if (count != 0)
            {
                string    sql = @"SELECT a.Bill_id,
                             a.prd_Batch_id,
                             a.materials_id,
                             a.Qty,
                             a.Pch,
                             a.Detail_id,
                             a.yxq,
                             a.PDate,
                             a.Price,
                             a.is_can_sale,
                             materials.name,
                             materials.spec,
                             vendor.vendor_name,
                             materials.unit,
                             materials.name,
		                     materials.select_code,
			                 materials.texture,
			                 materials.color,
			                 a.hwh,
			                 a.is_new,
                             total = Isnull((a.Price*a.Qty),0)
                        FROM pd_detail a,
                             materials,
                             vendor
                       WHERE ( materials.sccj_id *= vendor.vendor_id) and
                             ( a.materials_id = materials.id ) and
			                    a.bill_id ='"             + ViewState["billId"].ToString().Trim() + "'";
                DataTable dt  = new SelectCommandBuilder().ExecuteDataTable(sql);
                aList.Clear();
                if (dt != null && dt.Rows.Count != 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        AddData a = new AddData()
                        {
                            id            = dt.Rows[i]["Detail_id"].ToString(),
                            pm            = dt.Rows[i]["name"].ToString(),
                            spec          = dt.Rows[i]["spec"].ToString(),
                            cz            = dt.Rows[i]["texture"].ToString(),
                            ys            = dt.Rows[i]["color"].ToString(),
                            goods_unit    = dt.Rows[i]["unit"].ToString(),
                            pch           = dt.Rows[i]["pch"].ToString(),
                            hwh           = dt.Rows[i]["hwh"].ToString(),
                            pdsl          = Convert.ToDecimal(dt.Rows[i]["qty"]).ToString("0.##"),
                            Price         = dt.Rows[i]["price"].ToString() == "" ? "0.00" : Convert.ToDecimal(dt.Rows[i]["price"]).ToString("0.##"),
                            total         = dt.Rows[i]["price"].ToString() == "" ? "0.00" : (Convert.ToDecimal(dt.Rows[i]["qty"]) * Convert.ToDecimal(dt.Rows[i]["price"])).ToString("0.##"),
                            customer_name = dt.Rows[i]["vendor_name"].ToString()
                        };
                        aList.Add(a);
                    }
                }
                gvAddData.DataSource = aList;
                gvAddData.DataBind();
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "focus", "<script>alert('删除失败!')</script>");
            }
        }
示例#60
0
 protected void gdvContacters_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
 }