Пример #1
0
    protected void ddl_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
        DropDownList ddl = DetailsView1.FindControl("DropDownList1") as DropDownList;
        string userid = Session["userid"].ToString();
        if (ddl != null && userid != null)
        {
            string plec;

            plec = ddl.SelectedValue;
            SqlConnection con = new SqlConnection(ConnectionString);
            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("UPDATE user_profile SET plec = @plec WHERE userid = @userid", con);
                cmd.Parameters.AddWithValue("@userid", userid);
                cmd.Parameters.AddWithValue("@plec", plec);
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                HttpContext.Current.Trace.Write(ex.Message);
            }
            finally
            {
                con.Close();
            }

        }
    }
    protected void DetailsView_Route_has_Bus_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
        String Route_has_Bus_ID = DetailsView_Route_has_Bus.SelectedValue.ToString();
        DropDownList D_Bus_ID_NEW = (DropDownList)DetailsView_Route_has_Bus.FindControl("DropDownList3");
        DropDownList D_Bus_ID_OLD = (DropDownList)DetailsView_Route_has_Bus.FindControl("DropDownList7");
        String Bus_ID_NEW = D_Bus_ID_NEW.SelectedValue;
        String Bus_ID_OLD = D_Bus_ID_OLD.SelectedValue;
        if (Bus_ID_NEW != Bus_ID_OLD)
        {
            delete_seat(Route_has_Bus_ID);

            SqlDataSource seat = new SqlDataSource();
            seat.ConnectionString =
                ConfigurationManager.ConnectionStrings["BusTicketConnectionString1"].ToString();

            String count_seat = get_seat_count(Bus_ID_NEW).ToString();
            String command = "";

            command = get_insert_command(count_seat, Route_has_Bus_ID);

            if (command != "")
            {
                String insertCommand = "INSERT INTO [Seat] "
                + " (Route_has_Bus_ID, Seat_Number, Seat_Name, Seat_Status) "
                + " VALUES "
                + command
                + ";";

                seat.InsertCommand = insertCommand;
                seat.Insert();
            }
        }
    }
Пример #3
0
 protected void NfteDetailsView_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
     Encryptor enc = new Encryptor();
     e.NewValues["monthly_netpay"] = enc.Encrypt(e.NewValues["monthly_netpay"].ToString());
     e.NewValues["monthly_gross_pay"] = enc.Encrypt(e.NewValues["monthly_gross_pay"].ToString());
     e.NewValues["ctc"] = enc.Encrypt(e.NewValues["ctc"].ToString());
     e.NewValues["ctc_medicals"] = enc.Encrypt(e.NewValues["ctc_medicals"].ToString());
 }
Пример #4
0
    protected void dvGame_ItemUpdating(object sender, DetailsViewUpdateEventArgs 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.NewValues["GamePictureURL"] = sVirtualFolder + sFileName + sExtension;
    }
Пример #5
0
 protected void employeeDetails_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
     // Read the employee from the DetailsView object
     int employeeId = (int)employeeDetails.DataKey.Value;
     // Find the TextBox controls with updated data
     TextBox newAddressTextBox =
        (TextBox)employeeDetails.FindControl("editAddressTextBox");
     TextBox newCityTextBox =
        (TextBox)employeeDetails.FindControl("editCityTextBox");
     // Extract the updated data from the TextBoxes
     string newAddress = newAddressTextBox.Text;
     string newCity = newCityTextBox.Text;
     // Define data objects
     SqlConnection conn;
     SqlCommand comm;
     // Initialize connection
     string connectionString =
     ConfigurationManager.ConnectionStrings[
     "Dorknozzle"].ConnectionString;
     // Initialize connection
     conn = new SqlConnection(connectionString);
     // Create command
     comm = new SqlCommand("UpdateEmployeeDetails", conn);
     comm.CommandType = CommandType.StoredProcedure;
     // Add command parameters
     comm.Parameters.Add("EmployeeID", SqlDbType.Int);
     comm.Parameters["EmployeeID"].Value = employeeId;
     comm.Parameters.Add("NewAddress", SqlDbType.NVarChar, 50);
     comm.Parameters["NewAddress"].Value = newAddress;
     comm.Parameters.Add("NewCity", SqlDbType.NVarChar, 50);
     comm.Parameters["NewCity"].Value = newCity;
     // Enclose database code in Try-Catch-Finally
     try
     {
       // Open the connection
       conn.Open();
       // Execute the command
       comm.ExecuteNonQuery();
     }
     finally
     {
       // Close the connection
       conn.Close();
     }
     // Exit edit mode
     employeeDetails.ChangeMode(DetailsViewMode.ReadOnly);
     // Reload the employees grid
     BindGrid();
     // Reload the details view
     BindDetails();
 }
Пример #6
0
    protected void DetailsView1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
       /* SqlConnection cnn = new SqlConnection(
 ConfigurationManager.ConnectionStrings
    ["fccl2ConnectionString"].ConnectionString);
        string query = "UPDATE MostreTancuri SET PrelevatorID = " +e.NewValues[2]  +
         " WHERE CodBare = '" + e.NewValues[0]+ "'";
        
        SqlCommand cmd = new SqlCommand(query, cnn);
        cmd.Connection.Open();
        cmd.ExecuteNonQuery();
        cmd.Connection.Close();
        */
    }
    protected void DetailsView1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
        FileUpload editImage = (FileUpload)DetailsView1.FindControl("FileUploadImageId");

        Label labelIdField = DetailsView1.FindControl("LabelIdField") as Label;
        if (labelIdField != null)
        {
            int trackId = Convert.ToInt32(labelIdField.Text);
            if (editImage.HasFile)
            {
                var bytes = editImage.FileBytes;
                Utils.UpdateTrackImage(trackId, bytes);

            }
        }
    }
Пример #8
0
    protected void DetailsView1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
        DropDownList ddl;
        ddl = (DropDownList)DetailsView1.FindControl("ddlStateUpdate");
        e.NewValues["StateID"] = ddl.SelectedValue;

        ddl = (DropDownList)DetailsView1.FindControl("ddlCountryUpdate");
        e.NewValues["CountryID"] = ddl.SelectedValue;

        ddl = (DropDownList)DetailsView1.FindControl("ddlEduLevelUpdate");
        e.NewValues["EducationLevelID"] = ddl.SelectedValue;

        ddl = (DropDownList)DetailsView1.FindControl("ddlJobTypeUpdate");
        e.NewValues["JobTypeID"] = ddl.SelectedValue;

        e.NewValues["PostedBy"] = Profile.UserName;
        e.NewValues["CompanyID"] = Profile.Employer.CompanyID.ToString();
        e.NewValues["PostingDate"] = DateTime.Today.ToString("MM/dd/yyyy");
    }
Пример #9
0
    protected void DetailsView1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
        FileUpload FileUpload1 = (FileUpload)DetailsView1.FindControl("FileUpload1");

        //string currentFilename = FileUploadLBL.TXT;  // need to find a way to access this label!

        string FileName = Path.GetFileName(FileUpload1.FileName); // stores relative filename path of uploaded image

        if (FileName != "")  // && FileName != currentFilename
        {
            FileName = "~/Images/Recipes/" + FileName;
            FileUpload1.SaveAs(Server.MapPath(FileName));
            RecipeaseDetailsViewSDS.UpdateParameters["rec_image_path"].DefaultValue = FileName;
        }
        else
        {
            FileName = "";
        }
    }
Пример #10
0
 protected void DetailsView1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
     string PD = Request.Form["S1"];
     string RC = Request.Form["S2"];
     string CM = Request.Form["S3"];
     string sql = "update PDCA set PD = @PD,RC = @RC,CM = @CM where ProblemNO = @ProblemNO";
     command = new SqlCommand(sql, con);
     SqlParameter[] para = new SqlParameter[]
     {
         new SqlParameter("@PD", PD),
         new SqlParameter("@RC", RC),
         new SqlParameter("@CM", CM),
         new SqlParameter("@ProblemNO", Session["petID"])
     };
     try
     {
         da.SelectCommand.Parameters.AddRange(para);
         if (con.State == ConnectionState.Open)
             con.Close();
         con.Open();
         int num = command.ExecuteNonQuery();
         if (num != 1)
             ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "info",
           "alert('内部错误,更新失败!');", true);
         else
         ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "info",
           "alert('修改成功!');", true);
     }
     catch (Exception)
     {
         ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "info",
           "alert('内部错误,更新失败,请联系管理员!');", true);
         return;
     }
     finally
     {
         con.Close();
         this.DetailsView1.ChangeMode(DetailsViewMode.ReadOnly);
         bind();
     }
 }
Пример #11
0
    protected void DetailsView1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
        //Need to handle the update manually because MembershipUser does not have a
        //parameterless constructor
        MembershipUser memUser = Membership.GetUser();

        memUser.Email = (string)e.NewValues[0];
        //memUser.Comment = (string)e.NewValues[1];
        //memUserIsApproved = (bool)e.NewValues[2];
        try
        {
            Membership.UpdateUser(memUser);

            e.Cancel = true;
            DetailsView1.ChangeMode(DetailsViewMode.ReadOnly);
        }
        catch (Exception ex)
        {
            Response.Write("<div>The following error occurred:<font color='red'> " + ex.Message + "</font></div>");
            e.Cancel = true;
        }
    }
Пример #12
0
    protected void PersonalDetailsView_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
        IUserDetailBussinessService userDetailBussinessService = null;
        UserDetailDAO userDetailsDAO = null; ;

        try
        {
            userDetailsDAO = UpdateUserDetailsDAO();
            userDetailBussinessService = BizDelegateFactory.Current.UserDetailBussinessService;
            MyTransactionsGridView.DataSource = userDetailBussinessService.UpdatePersonalDetails(userDetailsDAO);
            MyTransactionsGridView.DataBind();
        }
        catch (Exception ex)
        {
            ShowMessage(ex.Message, MessageInfo.Error);
        }
        finally
        {
            userDetailBussinessService = null;
            userDetailsDAO = null;
        }
    }
Пример #13
0
    protected void DetailsView1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
        SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["fccl2ConnectionString"].ConnectionString);
        SqlCommand cmd = new SqlCommand();
        cmd.Connection = cnn;
        string crot = e.NewValues["Crotalia"].ToString();
        string oldcrot = e.Keys["Crotalia"].ToString();
        e.Keys["Crotalia"] = crot;
        OldCrot.Text = oldcrot;
        
        if (crot.Trim().Length == 0)
        {
            Label2.Text = "Crotalia este camp obligatoriu !";
            e.Cancel = true;
            return;
        }
		if (oldcrot != crot) {
        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();
        }
		else
		Label2.Text ="";

      
    }
Пример #14
0
 protected void dvAddBook_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
     Response.Write(e.NewValues["Title"]);
 }
 protected void wpsDetailsView_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
 }
Пример #16
0
 protected void dvMemorialBooking_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
     try
     {
         e.NewValues["TransactionDate"] = TransactionDate;
         e.NewValues["Description"] = Description;
     }
     catch (Exception ex)
     {
         lblErrorMessageDV.Text = Utility.GetCompleteExceptionMessage(ex);
         e.Cancel = true;
     }
 }
    protected void DetailsViewTarget_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
        TextBox test_started = (TextBox)DetailsViewTarget.FindControl("TextBox3");
        TextBox test_completed = (TextBox)DetailsViewTarget.FindControl("TextBox4");
        TextBox certification_submit_to_authority = (TextBox)DetailsViewTarget.FindControl("TextBox5");
        TextBox certification_completed = (TextBox)DetailsViewTarget.FindControl("TextBox6");
        TextBox TextBox_Actual_Lead_time = (TextBox)DetailsViewTarget.FindControl("TextBox_Actual_Lead_time");
        TextBox textBoxEstimated = (TextBox)DetailsViewTarget.FindControl("TextBoxEstimated");
        TextBox txtProcess = (TextBox)DetailsViewTarget.FindControl("txtProcess"); //2013/5/6 新增需求
        DropDownList ddlStatus = (DropDownList)DetailsViewTarget.FindControl("ddlStatus");

        decimal wk = 0;

        if (!string.IsNullOrEmpty(txtProcess.Text) && !string.IsNullOrEmpty(certification_completed.Text))
        {
          DateTime dt_txtProcess = DateTime.Parse(txtProcess.Text);
          DateTime dt_certification_completed = DateTime.Parse(certification_completed.Text);
          wk = Math.Ceiling(decimal.Parse(dt_certification_completed.Subtract(dt_txtProcess).Days.ToString()) / 7);
          TextBox_Actual_Lead_time.Text = wk.ToString();
        }
        SqlDataSourceModifyTarget.UpdateParameters["Actual_Lead_time"].DefaultValue = wk.ToString();

        DropDownList ddlEmp = (DropDownList)DetailsViewTarget.FindControl("DropDownListEmp");
        SqlDataSourceModifyTarget.UpdateParameters["Country_Manager"].DefaultValue = ddlEmp.SelectedValue;

        if (!string.IsNullOrEmpty(textBoxEstimated.Text))
        {
          // Actual > Estimated 則屬逾時
          if (int.Parse(wk.ToString()) > int.Parse(textBoxEstimated.Text))
          {
        SqlDataSourceModifyTarget.UpdateParameters["Status"].DefaultValue = "Delay";
          }
          else
          {
        SqlDataSourceModifyTarget.UpdateParameters["Status"].DefaultValue = ddlStatus.SelectedValue;
          }
        }
        else
        {
          SqlDataSourceModifyTarget.UpdateParameters["Status"].DefaultValue = ddlStatus.SelectedValue;
        }

        //2015/2/6 新增需求:若Status=Done則certification completed必填
        if (ddlStatus.SelectedValue == "Done" && string.IsNullOrEmpty(certification_completed.Text.Trim()))
        {
          Label lblStatusMessage = (Label)DetailsViewTarget.FindControl("lblStatusMessage");
          lblStatusMessage.Text = "Warning : If Target Status is 'Done' then Certification Completed can't be Empty!";
          Message.Text = "Target Details Update Fail!";
          e.Cancel = true;
        }

        HFAccordionStatus.Value = "2";//控制accordion
    }
Пример #18
0
    protected void NotAssignedVacDV_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
        try
        {
            string vacancyTitle = e.NewValues["[Vacancy Title]"].ToString().Trim();
            string branchID = e.NewValues["branch_id"].ToString().Trim();
            string deadLine = e.NewValues["[Vacancy Deadline]"].ToString().Trim();
            string jGrade = e.NewValues["[Job Grade]"].ToString().Trim();
            string year4Gen = e.NewValues["[Year required for General]"].ToString().Trim();
            string year4Spec = e.NewValues["[Year required for Specific]"].ToString().Trim();
            string genPerc = e.NewValues["[General Work Exp Percentage]"].ToString().Trim();
            string specPerc = e.NewValues["[Specific Work Exp Percentage]"].ToString().Trim();
            string RelPer = e.NewValues["[Related Work Exp Percentage]"].ToString().Trim();
            string examPer = e.NewValues["[Examination Percentage]"].ToString().Trim();
            string mangRec = e.NewValues["[Manageral Rec Percentage]"].ToString().Trim();
            string interviewPer = e.NewValues["[Interview Percentage]"].ToString().Trim();
            string benefit = e.NewValues["[Job Benefit]"].ToString().Trim();
            string jobDes = e.NewValues["[Job Description]"].ToString().Trim();
            string jobReq = e.NewValues["[Job Requirement]"].ToString().Trim();
            
            Vacancy vacancy = new Vacancy();

            vacancy.VancayTitle = vacancyTitle;
            vacancy.BranchId = branchID;
            vacancy.VancyDeadline = deadLine;
            vacancy.VacancyforJobGrade = jGrade;
            vacancy.YearRequiredforGeneral = year4Gen;
            vacancy.YearRequiredforSpec = year4Spec;
            vacancy.GeneralWrkExprPercent = genPerc;
            vacancy.SpecificWrkExprPercent = specPerc;
            vacancy.RelatedWrkExprPercent = RelPer;
            vacancy.ExaminationPercent = examPer;
            vacancy.ManagerRecPercent = mangRec;
            vacancy.InterviewPercent = interviewPer;
            vacancy.SalaryAndBenefit = benefit;
            vacancy.JobDescription = jobDes;
            vacancy.JobRequirement = jobReq;

            vacancy.VacancyNo = vacancyNoforGV;
            vacancy.PostedDate = postDate;

            VacancyRegistrationAndEvaluationManager manager = new VacancyRegistrationAndEvaluationManager();
            TransactionResponse response = new TransactionResponse();
            
            response = manager.updateVacancyDetailNotAssignedtoHROfficer(vacancy);
            if (response.isSuccessful())
            {
                NotAssignedVacDV.ChangeMode(DetailsViewMode.ReadOnly);
                BindAssignedVacToDetailView();

                msgPanel.Visible = true;
                SucessDIV.Visible = true;
                lblSuccessMessage.Text = response.getMessage();
            }
            else
            {
                msgPanel.Visible = true;
                ErroroDIV.Visible = true;
                lblErrorMsg.Text = response.getMessage();
            }

        }
        catch (Exception ex)
        {
            msgPanel.Visible = true;
            lblErrorMsg.Text = ex.StackTrace.ToString();
        }
    }
        protected void userDetailsView_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
        {
            TextBox      txtNewFirstName  = (TextBox)userDetailsView.FindControl("txtEditFirstName");
            TextBox      txtNewLastName   = (TextBox)userDetailsView.FindControl("txtEditLastName");
            DropDownList ddlNewGender     = (DropDownList)userDetailsView.FindControl("ddlEditGender");
            TextBox      txtNewEmailID    = (TextBox)userDetailsView.FindControl("txtEditEmailID");
            TextBox      txtNewUsername   = (TextBox)userDetailsView.FindControl("txtEditUsername");
            TextBox      txtNewPassword   = (TextBox)userDetailsView.FindControl("txtEditPassword");
            TextBox      txtNewAddress    = (TextBox)userDetailsView.FindControl("txtEditAddress");
            TextBox      txtNewProvince   = (TextBox)userDetailsView.FindControl("txtEditProvince");
            TextBox      txtNewCity       = (TextBox)userDetailsView.FindControl("txtEditCity");
            TextBox      txtNewPostalCode = (TextBox)userDetailsView.FindControl("txtEditPostalCode");

            string NewFirstName  = txtNewFirstName.Text;
            string NewLastName   = txtNewLastName.Text;
            string NewGender     = ddlNewGender.Text;
            string NewEmailID    = txtNewEmailID.Text;
            string NewUsername   = txtNewUsername.Text;
            string NewPassword   = txtNewPassword.Text;
            string NewAddress    = txtNewAddress.Text;
            string NewProvince   = txtNewProvince.Text;
            string NewCity       = txtNewCity.Text;
            string NewPostalCode = txtNewPostalCode.Text;

            string getUsername = string.Empty;

            getUsername = Login.txtInput;

            SqlConnection conn;
            SqlCommand    comm;
            string        connectionString = ConfigurationManager.ConnectionStrings["PepperCrownKitchen"].ConnectionString;

            conn = new SqlConnection(connectionString);
            string sqlString = "update Customer set FirstName=@FirstName, LastName=@LastName, Gender=@Gender, EmailID=@EmailID, Username=@Username, Password=@Password, Address=@Address, Province=@Province, City=@City, PostalCode=@PostalCode where Username=@UN";

            comm = new SqlCommand(sqlString, conn);

            comm.Parameters.Add("@UN", System.Data.SqlDbType.NVarChar, 50);
            comm.Parameters["@UN"].Value = getUsername;

            comm.Parameters.Add("@FirstName", System.Data.SqlDbType.NVarChar, 50);
            comm.Parameters["@FirstName"].Value = NewFirstName;
            comm.Parameters.Add("@LastName", System.Data.SqlDbType.NVarChar, 50);
            comm.Parameters["@LastName"].Value = NewLastName;
            comm.Parameters.Add("@Gender", System.Data.SqlDbType.NVarChar, 50);
            comm.Parameters["@Gender"].Value = NewGender;
            comm.Parameters.Add("@EmailID", System.Data.SqlDbType.NVarChar, 50);
            comm.Parameters["@EmailID"].Value = NewEmailID;
            comm.Parameters.Add("@Username", System.Data.SqlDbType.NVarChar, 50);
            comm.Parameters["@Username"].Value = NewUsername;
            comm.Parameters.Add("@Password", System.Data.SqlDbType.NVarChar, 50);
            comm.Parameters["@Password"].Value = NewPassword;
            comm.Parameters.Add("@Address", System.Data.SqlDbType.NVarChar, 50);
            comm.Parameters["@Address"].Value = NewAddress;
            comm.Parameters.Add("@Province", System.Data.SqlDbType.NVarChar, 50);
            comm.Parameters["@Province"].Value = NewProvince;
            comm.Parameters.Add("@City", System.Data.SqlDbType.NVarChar, 50);
            comm.Parameters["@City"].Value = NewCity;
            comm.Parameters.Add("@PostalCode", System.Data.SqlDbType.NVarChar, 50);
            comm.Parameters["@PostalCode"].Value = NewPostalCode;

            try
            {
                conn.Open();
                comm.ExecuteNonQuery();
            }
            catch (SqlException ex)
            {
            }
            finally
            {
                conn.Close();
            }
            userDetailsView.ChangeMode(DetailsViewMode.ReadOnly);
            BindList();
        }
Пример #20
0
 protected void SuperForm1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
     e.NewValues["CountryIds"] = GetSelectedCountries();
 }
        protected void DetailsView1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
        {
            try
            {
                using (Entity entity = new Entity())
                {
                    var order = entity.Order.Find(DetailsView1.DataKey.Value.ToString());

                    var CheckBoxList_State = ((CheckBoxList)DetailsView1.FindControl("CheckBoxList_State"));
                    order.State = 0;
                    int fahuoTemp = order.State & 4;
                    foreach (ListItem item in CheckBoxList_State.Items)
                    {
                        if (item.Selected)
                        {
                            order.State = order.State | Convert.ToInt32(item.Value);
                        }
                    }

                    if (fahuoTemp == 0)
                    {
                        if ((order.State & 4) > 0)
                        {
                            OrderLog orderLog = new OrderLog();
                            orderLog.OrderID    = order.OrderID;
                            orderLog.State      = 2;
                            orderLog.CreateTime = DateTime.Now;
                            orderLog.Mark       = "卖家发货";
                            orderLog.UserId     = Convert.ToInt32(Session["userID"]);
                            entity.OrderLog.Add(orderLog);
                            if (order.UserID != null)
                            {
                                string text = string.Format("您的订单{0}已经发货", order.OrderID);
                                UserLetterBLL.Create(Convert.ToInt32(Session["userID"]), order.UserID.Value, text, 1 | 8);

                                ThreadPool.QueueUserWorkItem(delegate(object a)
                                {
                                    string tt = @"您的订单 " + order.OrderID + " 已经发货,不日则到。请注意查收您的订单 ";
                                    using (Entity entity1 = new Entity())
                                    {
                                        UserSMS userSMS = new UserSMS()
                                        {
                                            Tel = entity1.User.Find(order.UserID).Tel
                                        };

                                        string bb = SMS.sendSMS(userSMS.Tel, tt, userSMS.SerialNumber);
                                    }
                                });
                            }
                        }
                    }


                    var DropDownList1 = ((DropDownList)DetailsView1.FindControl("DropDownList1"));
                    order.LogisticsCompany = DropDownList1.SelectedValue;
                    if (e.NewValues["LogisticsNumber"] != null)
                    {
                        order.LogisticsNumber = e.NewValues["LogisticsNumber"].ToString();
                    }
                    order.UpdateTime = DateTime.Now;

                    entity.SaveChanges();

                    Response.Redirect("OrderDetail.aspx?OrderID=" + order.OrderID);
                }
            }
            catch (Exception exception)
            {
                string error = exception.GetErrorMessage().Replace("'", "\\'").Replace("\"", "\\\"").Replace("\r\n", "\\r\\n");
                ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", string.Format("<script>alert('{0}')</script>", error));
            }
        }
Пример #22
0
    protected void dvCustomer_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
        DataAccessLayer dal    = new DataAccessLayer();
        string          errors = "";

        e.NewValues["Stabsnummer"] = e.NewValues["Stabsnummer"].ToString().ToUpper();

        dal.AddParameter("@MANR", e.NewValues["MANR"], System.Data.DbType.String);
        dal.AddParameter("@Stabsnummer", e.NewValues["Stabsnummer"], System.Data.DbType.String);
        dal.AddParameter("@ID", CustomerID, System.Data.DbType.Int32);
        errors = dal.ExecuteScalar("DECLARE @errors VARCHAR(2);EXEC @errors = dbo.CustomerExists @MANR, @Stabsnummer, @ID;SELECT @errors").ToString();
        dal.ClearParameters();

        if (errors != "0")
        {
            lblError.Text    = Utilities.GetErrorMsg(errors);
            lblError.Visible = true;
            e.Cancel         = true;
        }

        e.NewValues["UserID"] = Membership.GetUser().ProviderUserKey;

        string changedNote = "";

        if (!Utilities.CompareValues(e.OldValues["MANR"], e.NewValues["MANR"]))
        {
            changedNote += "MANR, ";
        }
        if (!Utilities.CompareValues(e.OldValues["Stabsnummer"], e.NewValues["Stabsnummer"]))
        {
            changedNote += "Stabsnummer, ";
        }
        if (!Utilities.CompareValues(e.OldValues["Firstname"], e.NewValues["Firstname"]))
        {
            changedNote += "Fornavn, ";
        }
        if (!Utilities.CompareValues(e.OldValues["Middlename"], e.NewValues["Middlename"]))
        {
            changedNote += "Mellemnavn, ";
        }
        if (!Utilities.CompareValues(e.OldValues["Lastname"], e.NewValues["Lastname"]))
        {
            changedNote += "Efternavn, ";
        }
        if (!Utilities.CompareValues(e.OldValues["Phone"], e.NewValues["Phone"]))
        {
            changedNote += "Telefonnr, ";
        }
        if (!Utilities.CompareValues(e.OldValues["MYN"], e.NewValues["MYN"]))
        {
            changedNote += "MYN, ";
        }
        if (!Utilities.CompareValues(e.OldValues["ENH"], e.NewValues["ENH"]))
        {
            changedNote += "ENH, ";
        }
        if (!Utilities.CompareValues(e.OldValues["AFD"], e.NewValues["AFD"]))
        {
            changedNote += "AFD, ";
        }
        if (!Utilities.CompareValues(e.OldValues["Comment"], e.NewValues["Comment"]))
        {
            changedNote += "Bemærkninger, ";
        }

        changedNote = Utilities.RemoveEndString(changedNote, ", ");

        e.NewValues["Note"] = changedNote;
    }
Пример #23
0
 protected void mfDataCollector_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
     UpdateUserGroup(e.NewValues);
 }
Пример #24
0
 protected void DetailsView1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
     this.gdItemHoja.DataBind();
 }
Пример #25
0
        protected void DetailsViewCustomer_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
        {
            try
            {
                //e.Cancel = true;

                if (this.metaManager == null)
                {
                    this.metaManager = new MetaManager();
                }

                if ((e.NewValues.Count > 0) && (e.NewValues.Contains("ReferenceID")))
                {
                    if (e.NewValues["ReferenceID"] != null)
                    {
                        //this.customers[0].ReferenceID = e.NewValues["ReferenceID"].ToString();
                        this.customers[0].ReferenceID = e.NewValues["ReferenceID"] as string[];
                    }
                    else
                    {
                        this.customers[0].ReferenceID = null;
                    }
                }

                //if (!String.IsNullOrEmpty(this.customers[0].ReferenceID))
                //{
                //    Customer[] custsInDB = this.metaManager.ListCustomers(false);

                //    if (custsInDB.Count((c)=>((c.ReferenceID == this.customers[0].ReferenceID) && (c.ID != this.customers[0].ID))) > 0)
                //    {
                //        e.Cancel = true;

                //        string script = String.Format("window.alert('The Business Reference ID of \"{0}\" has been bound to another configuration set, please double check!');", this.customers[0].ReferenceID);

                //        this.Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), Guid.NewGuid().ToString(), script, true);
                //    }
                //}

                if (this.customers[0].ReferenceID != null)
                {
                    Customer[] custsInDB = this.metaManager.ListCustomers(false);

                    if (custsInDB != null)
                    {
                        if (custsInDB.Count((c) => (c.ID != this.customers[0].ID)) > 0)
                        {
                            custsInDB = custsInDB.Where((c) => (c.ID != this.customers[0].ID)).ToArray();

                            foreach (string refID in this.customers[0].ReferenceID)
                            {
                                if (custsInDB.Count((c) => ((c.ReferenceID != null) && (c.ReferenceID.Contains(refID)))) > 0)
                                {
                                    e.Cancel = true;

                                    string script = String.Format("window.alert('The Business Reference ID of \"{0}\" has been bound to another configuration set, please double check!');", refID);

                                    this.Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), Guid.NewGuid().ToString(), script, true);

                                    return;
                                }
                            }
                        }
                    }
                }

                int result = this.metaManager.UpdateCustomerConfiguration(this.customers[0]);

                this.DetailsViewCustomer.ChangeMode(DetailsViewMode.ReadOnly);

                this.isSwitchingViewMode = true;

                this.getData(this.customerID);
                this.addCustomerDataToCache();
                this.bindData();
            }
            catch (Exception ex)
            {
                //TracingUtility.Trace(new object[] { ex.ToString() }, TracingUtility.DefaultTraceSourceName);

                Provider.Tracer().Trace(new object[] { ex.ToString() }, null);

                //throw;

                //string script = String.Format("window.alert('The following error(s) occurred: {0}');", ex.Message);

                string exMsg = ex.Message;

                exMsg = exMsg.Replace(System.Environment.NewLine, "");
                exMsg = exMsg.Replace("\r\n", "");

                string script = String.Format("window.alert('The following error(s) occurred: {0}');", exMsg);

                this.Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), Guid.NewGuid().ToString(), script, true);
            }
        }
Пример #26
0
 protected void dvBankStatement_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
     try
     {
         e.NewValues["CanChangeTransactionDate"] = CanChangeTransactionDate;
         if (CanChangeTransactionDate)
             e.NewValues["TransactionDate"] = TransactionDate;
         e.NewValues["ClosingBalanceQuantity"] = ClosingBalanceQuantity;
     }
     catch (Exception ex)
     {
         lblErrorMessageDV.Text = Utility.GetCompleteExceptionMessage(ex);
         e.Cancel = true;
     }
 }
Пример #27
0
        protected void dvStudentsDetails_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
        {
            string strMensajeError = null;

            TextBox strMName   = (TextBox)dvStudentsDetails.FindControl("txtFName");
            TextBox strDOB     = (TextBox)dvStudentsDetails.FindControl("txtDOB");
            TextBox strCountry = (TextBox)dvStudentsDetails.FindControl("txtCountry");
            TextBox strState   = (TextBox)dvStudentsDetails.FindControl("txtState");
            TextBox strCity    = (TextBox)dvStudentsDetails.FindControl("txtCity");
            TextBox strAddrLin = (TextBox)dvStudentsDetails.FindControl("txtAddressLine");
            TextBox strCelular = (TextBox)dvStudentsDetails.FindControl("txtCelular");
            TextBox strZcode   = (TextBox)dvStudentsDetails.FindControl("txtZipcode");
            TextBox strLName   = (TextBox)dvStudentsDetails.FindControl("txtLname");
            TextBox strEmail   = (TextBox)dvStudentsDetails.FindControl("txtEmail");
            TextBox strSID     = (TextBox)dvStudentsDetails.FindControl("txtSID");

            // Validate before insert
            //Validate - Missing StudentID

            if (strMName.Text == null || strMName.Text == "")
            {
                strMensajeError += "Missing First Name.";
                e.Cancel         = true;
            }
            if (strLName.Text == null || strLName.Text == "")
            {
                strMensajeError += "Missing Last Name.";
                e.Cancel         = true;
            }
            if (strDOB.Text == null || strDOB.Text == "")
            {
                strMensajeError += "Missing Date of Birth (MM-DD-YYYY).";
                e.Cancel         = true;
            }
            if (strCountry.Text == null || strCountry.Text == "")
            {
                strMensajeError += "Missing Country.";
                e.Cancel         = true;
            }
            if (strState.Text == null || strState.Text == "")
            {
                strMensajeError += "Missing State.";
                e.Cancel         = true;
            }
            if (strCity.Text == null || strCity.Text == "")
            {
                strMensajeError += "Missing City.";
                e.Cancel         = true;
            }
            if (strAddrLin.Text == null || strAddrLin.Text == "")
            {
                strMensajeError += "Missing Adress Line 1.";
                e.Cancel         = true;
            }
            if (strCelular.Text == null || strCelular.Text == "")
            {
                strMensajeError += "Missing Celular.";
                e.Cancel         = true;
            }
            if (strZcode.Text == null || strZcode.Text == "")
            {
                strMensajeError += "Missing Zip Code.";
                e.Cancel         = true;
            }
            //if (strEmail.Text == null || strEmail.Text == "")
            //{
            //    strMensajeError += "Missing Email Address.";
            //    e.Cancel = true;
            //}

            //// Validate -Sudent Email
            //if (strEmail.Text.Length != 8)

            //{
            //    strMensajeError += "Enter a valid Email Address";
            //    e.Cancel = true;
            //}
            // If prevoius validation throws an error, return the error
            if (e.Cancel == true)
            {
                lblMessage.Text = "Insert Error! <br />" +
                                  strMensajeError.ToString() + "</div>";
                StrssMessage = "Insert Error! <br />" +
                               strMensajeError.ToString() + "</div>";
            }
        }
 protected void SuperForm1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
     e.NewValues["ShipCountry"] = ((Obout.ComboBox.ComboBox)((DetailsViewRow)SuperForm1.Rows[4]).FindControl("ShipCountry")).SelectedValue;
 }
Пример #29
0
    protected void DetailsView1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
        DropDownList DropDownList1 = this.DetailsView1.FindControl("DropDownList1") as DropDownList;

        this.odsDetail.UpdateParameters.Add("CategoryId", DropDownList1.SelectedValue);
    }
Пример #30
0
 protected void dvPatientMedication_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
 }
 protected void DocumentDW_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
     //wE COME HERE AFTER UPDATE IS DONE NOW NOW AGAIN CHANGEMODE AND GET DETAILS
     DocumentDW.ChangeMode(DetailsViewMode.ReadOnly);
     GetDocumentDetails();
 }
Пример #32
0
    // ***************************************************************************************** Handle update event video detail view************
    protected void videoDetail_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
        Session["videoEdit"] = "";
        int selectRowIndex = videoInfoGrid.SelectedIndex;
        int videoInfoID = (int)videoInfoGrid.DataKeys[selectRowIndex].Value;

        SqlConnection conn;
        SqlCommand edCkBoxDeleteComm;
        SqlCommand edCkBoxAddComm;
        SqlCommand impCkBoxDeleteComm;
        SqlCommand impCkBoxAddComm;
        SqlCommand comm;
        string connectionString = ConfigurationManager.ConnectionStrings["leoQuickStart"].ConnectionString;
        conn = new SqlConnection(connectionString);
        //Find checkboxes and delete previous values
        CheckBoxList cboVidDetailsEdCB = (CheckBoxList)videoDetail.FindControl("cbVidEdEdit");
        CheckBoxList cboVidDetailsImpStepsCB = (CheckBoxList)videoDetail.FindControl("videoImpStepsCBEdit");
        edCkBoxDeleteComm = new SqlCommand("DELETE FROM videoEditions WHERE videoInfoID=" + videoInfoID + "", conn);
        impCkBoxDeleteComm = new SqlCommand("DELETE FROM impStepVids WHERE videoInfoID=" + videoInfoID + "", conn);
        try
        {
            conn.Open();
            edCkBoxDeleteComm.ExecuteNonQuery();
            impCkBoxDeleteComm.ExecuteNonQuery();
        }
        catch (SqlException exB)
        {
            newEdError.Style.Clear();
            newEdError.Text =
                "<div class=\"errorMessageSearch\">Error There has been an error trying to delete Imp Steps <br /> [" + exB.Message + "]</div>";
        }
        finally
        {
            conn.Close();
        }
        // loop through new selected video editions so you can add new values when updating details.
        foreach (ListItem item in cboVidDetailsEdCB.Items)
        {
            edCkBoxAddComm = new SqlCommand("INSERT INTO videoEditions (videoEdID, videoInfoID) VALUES (" + item.Value + ", " + videoInfoID + ")", conn);
            if (item.Selected)
            {
                try
                {
                    conn.Open();
                    edCkBoxAddComm.ExecuteNonQuery();

                }
                catch (SqlException exA)
                {

                    newEdError.Style.Clear();
                    newEdError.Text =
                        "<div class=\"errorMessageSearch\">Error There has been an error trying to re-add imp steps <br /> [" + exA.Message + "]</div>";
                }
                finally
                {
                    conn.Close();
                    h3Title.Text = "Video Detail Information";
                }

            }
        }

        // loop through new selected implementation steps so you can add new values when updating details.
        foreach (ListItem item in cboVidDetailsImpStepsCB.Items)
        {
            impCkBoxAddComm = new SqlCommand("INSERT INTO impStepVids (impStepID, videoInfoID) VALUES (" + item.Value + ", " + videoInfoID + ")", conn);
            if (item.Selected)
            {
                try
                {
                    conn.Open();
                    impCkBoxAddComm.ExecuteNonQuery();

                }
                catch (SqlException exA)
                {

                    newEdError.Style.Clear();
                    newEdError.Text =
                        "<div class=\"errorMessageSearch\">Error There has been an error trying to re-add imp steps <br /> [" + exA.Message + "]</div>";
                }
                finally
                {
                    conn.Close();
                }

            }
        }

        TextBox newVidName = (TextBox)videoDetail.FindControl("videoNameEdit");
        string NewVidName = newVidName.Text;
        TextBox newVidLenght = (TextBox)videoDetail.FindControl("videoLenghtEdit");
        string NewVidLenght = newVidLenght.Text;
        DropDownList newVidAuthor = (DropDownList)videoDetail.FindControl("ddlVidAuthorEdit");
        int NewVidAuthor = Convert.ToInt32(newVidAuthor.SelectedValue);
        DropDownList newVidCategory = (DropDownList)videoDetail.FindControl("ddlVidCatEdit");
        int NewVidCategory = Convert.ToInt32(newVidCategory.SelectedValue);
        TextBox newVidSCNumber = (TextBox)videoDetail.FindControl("videoSCVNEdit");
        string NewVidSCNumber = newVidSCNumber.Text;
        TextBox newVidSCFN = (TextBox)videoDetail.FindControl("videoSCFNEdit");
        string NewVidSCFN = newVidSCFN.Text;
        TextBox newVidKeyWords = (TextBox)videoDetail.FindControl("videokeyWrdsEdit");
        string NewVidKeyWords = newVidKeyWords.Text;
        TextBox newVidDescription = (TextBox)videoDetail.FindControl("videoDescEdit");
        string NewVidDescription = newVidDescription.Text;
        TextBox newVidWidth = (TextBox)videoDetail.FindControl("videoWidthEdit");
        string NewVidWidth = newVidWidth.Text;
        TextBox newVidHeight = (TextBox)videoDetail.FindControl("videoHeightEdit");
        string NewVidHeight = newVidHeight.Text;

        comm = new SqlCommand("updateVideoDetails", conn);
        comm.CommandType = CommandType.StoredProcedure;
        comm.Parameters.Add("@videoInfoID", SqlDbType.Int);
        comm.Parameters["@videoInfoID"].Value = videoInfoID;
        comm.Parameters.Add("@NewvidName", System.Data.SqlDbType.NVarChar, 200);
        comm.Parameters["@NewvidName"].Value = NewVidName;
        comm.Parameters.Add("@NewvidAuthID", SqlDbType.Int);
        comm.Parameters["@NewvidAuthID"].Value = NewVidAuthor;
        comm.Parameters.Add("@NewvidCatID", SqlDbType.Int);
        comm.Parameters["@NewvidCatID"].Value = NewVidCategory;
        comm.Parameters.Add("@NewvidDescription", System.Data.SqlDbType.NVarChar, 2000);
        comm.Parameters["@NewvidDescription"].Value = NewVidDescription;
        comm.Parameters.Add("@NewvidLenght", System.Data.SqlDbType.NVarChar, 50);
        comm.Parameters["@NewvidLenght"].Value = NewVidLenght;
        comm.Parameters.Add("@NewvidLink", System.Data.SqlDbType.NVarChar, 300);
        comm.Parameters["@NewvidLink"].Value = NewVidSCNumber;
        comm.Parameters.Add("@NewvidFileName", System.Data.SqlDbType.NVarChar, 150);
        comm.Parameters["@NewvidFileName"].Value = NewVidSCFN;
        comm.Parameters.Add("@NewvidKeyWords", System.Data.SqlDbType.NVarChar, 150);
        comm.Parameters["@NewvidKeyWords"].Value = NewVidKeyWords;
        comm.Parameters.Add("@NewvidWidth", System.Data.SqlDbType.NVarChar, 10);
        comm.Parameters["@NewvidWidth"].Value = NewVidWidth;
        comm.Parameters.Add("@NewvidHeight", System.Data.SqlDbType.NVarChar, 10);
        comm.Parameters["@NewvidHeight"].Value = NewVidHeight;

        try
        {
            conn.Open();
            comm.ExecuteNonQuery();
        }
        finally
        {
            conn.Close();
        }
        videoDetail.ChangeMode(DetailsViewMode.ReadOnly);
        BindVideoDetails();
        // Clear viewstate to reload member grid.
        ViewState["VideosDataSet"] = null;
        BindVideoGrid();
    }
Пример #33
0
 protected void dtlProduct_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
 }
Пример #34
0
    protected void ItemDetails_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
        var item = e.NewValues.Cast<DictionaryEntry>().ToDictionary<DictionaryEntry, string, object>(x => x.Key as string, x => x.Value);

        item["UPC"] = e.Keys["UPC"];

        NormalizeItem(item);

        if (double.Parse(item["RegularPrice"] as string) > double.Parse(e.OldValues["RegularPrice"] as string))
        {
            DBHelper.Insert("PriceHistories", new Dictionary<string, object> {
                { "UPC", item["UPC"] },
                { "UpdateDate", DateTime.Today },
                { "Price", item["TenDaysPrice"] }
            });
        }
        else
        {
            item["TenDaysPrice"] = item["RegularPrice"];
        }

        DBHelper.Update("Items", item);

        // Notification begins
        var intro = String.Format("An item is updated, Details are as follows:\n\nName: {0}\nUPC: {1}", item["ItemName"], item["UPC"]);

        var data = DBHelper.GetTable("ItemNotifications").Table.AsEnumerable()
                .Where(r => r.Field<string>("UPC") == item["UPC"] as string)
                .Join(DBHelper.GetTable("Members").Table.AsEnumerable(),
                    i => i.Field<string>("UserId"),
                    m => m.Field<string>("UserId"),
                    (i, m) => new { Type = i.Field<int>("Type"), Email = m.Field<string>("Email") }
                );

        // Price change
        foreach(var key in new[] { "RegularPrice", "MemberPrice" })
        {
            double now, old;
            if(double.TryParse(item[key] as string, out now) && double.TryParse(e.OldValues[key] as string, out old) && now != old)
            {
                var prettyKey = key.Replace("Price", " Price");

                Email.Send(data.Where(x => x.Type == (now > old ? 1 : 2)).Select(x => x.Email),
                    String.Format("The {0} of Item \"{1}\" has changed on AsiaWebShop", prettyKey, item["ItemName"]),
                    new StringBuilder(intro).AppendFormat("\n\nOld {0}: {1}\nNew {0}: {2}",
                        prettyKey, e.OldValues[key] ?? "N/A", item[key] ?? "N/A").ToString()
                );
            }
        }

        // Stock change
        if (int.Parse(e.OldValues["StockQuantity"] as string) == 0 && int.Parse(item["StockQuantity"] as string) > 0)
        {
            Email.Send(data.Where(x => x.Type == 3).Select(x => x.Email),
                String.Format("The Item \"{0}\" is in stock again on AsiaWebShop", item["ItemName"]),
                new StringBuilder(intro).AppendFormat("Item is available again.\nCurrent Stock Quantity: {0}", item["StockQuantity"]).ToString()
            );
        }
        // Notification ends

        e.Cancel = true;
        SetDS(null);
        this.MainMV.SetActiveView(this.ItemGridView);
    }
Пример #35
0
 protected void dvChangeStatus_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
 }
    protected void DetailsView1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
        var codeCampYearResultThisYear = CodeCampYearManager.I.Get(new CodeCampYearQuery
        {
            Id = Utils.CurrentCodeCampYear
        }).FirstOrDefault();

        if (codeCampYearResultThisYear != null)
        {
            var startJob = e.NewValues["JobStartTime"];
            var endJob = e.NewValues["JobEndTime"];

            DateTime start = Convert.ToDateTime(startJob);
            DateTime end = Convert.ToDateTime(endJob);

            if (start.Year != codeCampYearResultThisYear.CampStartDate.Year || end.Year != codeCampYearResultThisYear.CampStartDate.Year)
            {
                e.Cancel = true;
                Literal1.Text = "can not add or update jobs from previous years";
            }

        }
    }
 protected void SuperForm1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
     e.NewValues["CountryIds"] = GetSelectedCountries();
 }
        protected void DetailsView1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
        {
            try
            {
                using (Entity entity = new Entity())
                {
                    var user = entity.User.Find(Convert.ToInt32(DetailsView1.DataKey.Value));
                    var CheckBoxList_Type = ((CheckBoxList)DetailsView1.FindControl("CheckBoxList_Type"));
                    user.Type = 0;
                    foreach (ListItem item in CheckBoxList_Type.Items)
                    {
                        if (item.Selected)
                        {
                            user.Type = user.Type | Convert.ToInt32(item.Value);
                        }
                    }
                    var RadioButtonList_Statet = ((RadioButtonList)DetailsView1.FindControl("RadioButtonList_State"));
                    user.State = Convert.ToInt32(RadioButtonList_Statet.SelectedValue);

                    var RadioButtonList_Banned = ((RadioButtonList)DetailsView1.FindControl("RadioButtonList_Banned"));
                    int bannedTemp             = user.UserExtend.Banned;
                    user.UserExtend.Banned = Convert.ToInt32(RadioButtonList_Banned.SelectedValue);
                    if (user.UserExtend.Banned == 1 && bannedTemp != 1)
                    {
                        new ExperienceLevelBLL().Jinyan(user.UserID);
                        user.UserExtend.BannedStartTime = DateTime.Now;
                        user.UserExtend.BannedEndTime   = user.UserExtend.BannedStartTime.Value.AddDays(3);
                        UserLetterBLL.Create(Convert.ToInt32(Session["userID"]), Convert.ToInt32(ViewState["userID"]), "您的发言被用户举报,已经被禁言三天。", 1 | 16);
                    }
                    else if (user.UserExtend.Banned == 0)
                    {
                        user.UserExtend.BannedEndTime = user.UserExtend.BannedStartTime = null;
                    }

                    if (e.NewValues["UserExtend.ExperienceLevel"] != null)
                    {
                        int level = Convert.ToInt32(e.NewValues["UserExtend.ExperienceLevel"]);
                        if (level == 0)
                        {
                            level = 1;
                        }
                        if (user.UserExtend.ExperienceLevel != level)
                        {
                            ExperienceLevel experienceLevel = entity.ExperienceLevel.Where(o => o.ExperienceLevelValue == level).FirstOrDefault();
                            if (experienceLevel == null)
                            {
                                throw new Exception("经验等级和等级不对应");
                            }
                            user.UserExtend.ExperienceLevel = experienceLevel.ExperienceLevelValue;
                            user.UserExtend.ExperienceValue = experienceLevel.ExperienceValueMin;
                            if (user.Gender == "男")
                            {
                                user.UserExtend.ExperienceName = experienceLevel.NameMan;
                            }
                            else
                            {
                                user.UserExtend.ExperienceName = experienceLevel.NameWoman;
                            }
                        }
                    }
                    entity.SaveChanges();
                }
                Response.Redirect("UserDetail.aspx?userID=" + DetailsView1.DataKey.Value);
            }
            catch (Exception exception)
            {
                string error = exception.GetErrorMessage().Replace("'", "\\'").Replace("\"", "\\\"").Replace("\r\n", "\\r\\n");
                ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", string.Format("<script>alert('{0}')</script>", error));
            }
        }
Пример #39
0
    protected void DetailsView1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
        TextBox newRecipeName  = (TextBox)DetailsView1.FindControl("txtRecipeName");
        TextBox newCategoryID  = (TextBox)DetailsView1.FindControl("txtCategoryID");
        TextBox newCookingtime = (TextBox)DetailsView1.FindControl("txtCookingtime");
        TextBox newServingtime = (TextBox)DetailsView1.FindControl("txtServingtime");
        TextBox newDescription = (TextBox)DetailsView1.FindControl("txtDescription");
        //       string userID = DetailsView1.FindControl(lblUserID.Text);

        string newName     = newRecipeName.Text;
        string newCategory = newCategoryID.Text;
        string newTime     = newCookingtime.Text;
        string newServing  = newServingtime.Text;
        string newDes      = newDescription.Text;

        try
        {
            OracleConnection conn = new OracleConnection(_connstring);
            conn.Open();
            OracleCommand comm = conn.CreateCommand();
            comm.CommandText = "Recipe_update2";
            comm.CommandType = CommandType.StoredProcedure;

            OracleParameter _InParam1 = new OracleParameter();
            _InParam1.ParameterName = "recipename1";
            _InParam1.OracleDbType  = OracleDbType.Varchar2;
            _InParam1.Direction     = ParameterDirection.Input;
            //            _InParam1.Value = tbxRecipeName.Text;
            //    _InParam1.Value = (TextBox)DetailsViewDetail.FindControl("editRecipename");
            _InParam1.Value = newName;
            comm.Parameters.Add(_InParam1);

            OracleParameter _InParam2 = new OracleParameter();
            _InParam2.ParameterName = "cookingtime1";
            _InParam2.OracleDbType  = OracleDbType.Varchar2;
            _InParam2.Direction     = ParameterDirection.Input;
            _InParam2.Value         = newTime;
            comm.Parameters.Add(_InParam2);

            OracleParameter _InParam3 = new OracleParameter();
            _InParam3.ParameterName = "SERVINGNUMBER1";
            _InParam3.OracleDbType  = OracleDbType.Varchar2;
            _InParam3.Direction     = ParameterDirection.Input;
            _InParam3.Value         = newServing;
            comm.Parameters.Add(_InParam3);

            OracleParameter _InParam4 = new OracleParameter();
            _InParam4.ParameterName = "DES1";
            _InParam4.OracleDbType  = OracleDbType.Varchar2;
            _InParam4.Direction     = ParameterDirection.Input;
            _InParam4.Value         = newDes;
            comm.Parameters.Add(_InParam4);


            OracleParameter _InParam5 = new OracleParameter();
            _InParam5.ParameterName = "CATE";
            _InParam5.OracleDbType  = OracleDbType.Varchar2;
            _InParam5.Direction     = ParameterDirection.Input;
            _InParam5.Value         = newCategory;
            comm.Parameters.Add(_InParam5);

            OracleParameter _InParam6 = new OracleParameter();
            _InParam6.ParameterName = "ID1";
            _InParam6.OracleDbType  = OracleDbType.Varchar2;
            _InParam6.Direction     = ParameterDirection.Input;
            _InParam6.Value         = Request.QueryString["param"];
            comm.Parameters.Add(_InParam6);


            comm.ExecuteNonQuery();

            comm.Connection.Close();
            comm.Connection.Dispose();
            comm = null;
        }
        catch (Exception ex)
        {
            Console.WriteLine("SQL error" + ex.Message);
            throw new Exception("Err in running" + ex.Message);
        }
        finally
        {
            //          conn.Connection.Close();
        }

        Response.Redirect("~/Recipes.aspx");
    }
 protected void SuperForm1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
     e.NewValues["ShipCountry"] = ((Obout.ComboBox.ComboBox)((DetailsViewRow)SuperForm1.Rows[2]).FindControl("ShipCountry")).SelectedText;
     string test = e.NewValues["ShipCountry"].ToString();
 }
 protected void DetailsView1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
    
 }
 protected void SuperForm1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
     e.NewValues["Image"] = fileName;
 }
 protected void SuperForm1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
     e.NewValues["Image"] = fileName;
 }
Пример #44
0
 protected void detailsTrophy_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
     e.NewValues.Add("SeriesID", GetSeriesId()); // get the drop list value from the detailsview
 }
Пример #45
0
 void dv_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
     dataUpdating = true;
 }
Пример #46
0
 protected void dvNews_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
     e.NewValues["Text"] = Utilities.StripHTML(e.NewValues["Text"].ToString());
 }
Пример #47
0
        protected void MovieDetailsView_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
        {
            try
            {
                MovieCatalogBL contextBL     = new MovieCatalogBL();
                var            movieToUpdate = contextBL.GetMovieByID(movieID);

                string contentProvider = null;
                if (e.NewValues["ContentProvider"] == null || e.NewValues["ContentProvider"].ToString() == "")
                {
                    contentProvider = "";
                }
                else
                {
                    contentProvider = e.NewValues["ContentProvider"].ToString();
                }

                string title = e.NewValues["OriginalName"].ToString();
                string genre = e.NewValues["Genre"].ToString();

                //msdn.microsoft.com/en-us/library/system.timespan%28v=vs.110%29.aspx
                //string value = "12:12:15";
                //TimeSpan ts = TimeSpan.Parse(value);
                TimeSpan movieDuration = TimeSpan.Zero;

                // find DropDownList control inside DetailsView
                DropDownList ddlHours   = (DropDownList)MovieDetailsView.FindControl("ddlHours");
                DropDownList ddlMinutes = (DropDownList)MovieDetailsView.FindControl("ddlMinutes");
                DropDownList ddlSeconds = (DropDownList)MovieDetailsView.FindControl("ddlSeconds");

                string hours   = ddlHours.SelectedValue.ToString().Trim();
                string minutes = ddlMinutes.SelectedValue.ToString().Trim();
                string seconds = ddlSeconds.SelectedValue.ToString().Trim();

                //string value = "12:12:15";
                //TimeSpan ts = TimeSpan.Parse(value);
                string duration1 = hours + ":" + minutes + ":" + seconds;
                movieDuration = TimeSpan.Parse(duration1);


                string country = e.NewValues["Country"].ToString();

                string rightsIPTV = null;
                if (e.NewValues["RightsIPTV"] == null || e.NewValues["RightsIPTV"].ToString() == "")
                {
                    rightsIPTV = string.Empty;
                }
                else
                {
                    rightsIPTV = e.NewValues["RightsIPTV"].ToString();
                }

                string rightsVOD = null;
                if (e.NewValues["RightsVOD"] == null || e.NewValues["RightsVOD"].ToString() == "")
                {
                    rightsVOD = string.Empty;
                }
                else
                {
                    rightsVOD = e.NewValues["RightsVOD"].ToString();
                }

                string svodRights = null;
                if (e.NewValues["SVODRights"] == null || e.NewValues["SVODRights"].ToString() == "")
                {
                    svodRights = string.Empty;
                }
                else
                {
                    svodRights = e.NewValues["SVODRights"].ToString();
                }

                string ancillaryRights = null;
                if (e.NewValues["AncillaryRights"] == null || e.NewValues["AncillaryRights"].ToString() == "")
                {
                    ancillaryRights = string.Empty;
                }
                else
                {
                    ancillaryRights = e.NewValues["AncillaryRights"].ToString();
                }


                DateTime startDate    = Convert.ToDateTime(e.NewValues["StartDate"]);
                DateTime expireDate   = Convert.ToDateTime(e.NewValues["ExpireDate"]);
                int      result       = DateTime.Compare(startDate, expireDate);
                string   relationship = "Expiry Date is earlier than Start Date !";
                //msdn.microsoft.com/en-us/library/5ata5aya%28v=vs.110%29.aspx
                // if startDate is later than expireDate result is (1) greater than 0 (zero)
                if (result > 0)
                {
                    // instead of "e.Cancel = true;" can be -> ((DetailsViewInsertEventArgs)e).Cancel = true;
                    // www.noordam.it/validating-detailsview-field-NewValues-during-insert-and-update/
                    // has to be 'return' after 'e.Cancel = true;'  -> at least in some cases
                    e.Cancel = true;
                    ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + relationship + "');", true);
                    return;
                }


                string comment = null;
                if (e.NewValues["Comment"] == null || e.NewValues["Comment"].ToString() == "")
                {
                    comment = string.Empty;
                }
                else
                {
                    comment = e.NewValues["Comment"].ToString();
                }

                Int16 year = Convert.ToInt16(e.NewValues["Year"]);

                contextBL.UpdateMovieByID(movieID, contentProvider, title, genre, movieDuration, country, rightsIPTV, rightsVOD, svodRights, ancillaryRights, startDate, expireDate, comment, year);
                lblMessage.ForeColor = System.Drawing.Color.Black;
                lblMessage.Text      = "Movie " + title + " updated.";
            }
            catch (DbUpdateException)
            {
                lblMessage.Text = "Update Exception. Error while updating movie data. Please try again.";
            }
            catch (NullReferenceException)
            {
                lblMessage.Text = "An error occurred while updating movie. Make sure that movie exists.";
            }
            catch (ArgumentNullException)
            {
                lblMessage.Text = "ArgumentNullException: An error occurred while updating movie. Make sure that movie exists.";
            }
            catch (Exception)
            {
                lblMessage.Text = "An error occurred while updating movie. Please try again.";
            }
        }
Пример #48
0
    protected void UserInfo_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
        // Need to handle the update manually because MembershipUser does not have a
        // parameterless constructor  

        user.Email = (string)e.NewValues[0];
        user.Comment = (string)e.NewValues[1];
        user.IsApproved = (bool)e.NewValues[2];

        try
        {
            // Update user info:
            System.Web.Security.Membership.UpdateUser(user);

            // Update user roles:
            UpdateUserRoles();

            UserUpdateMessage.Text = "Update Successful.";

            // make cancel button available
            e.Cancel = true;

            // make detailsview read only
            UserInfo.ChangeMode(DetailsViewMode.ReadOnly);
        }
        catch (Exception ex)
        {
            // if there is a problem
            UserUpdateMessage.Text = "Update Failed: " + ex.Message;

            e.Cancel = true;
            UserInfo.ChangeMode(DetailsViewMode.ReadOnly);
        }
    }
Пример #49
0
 protected void mfScoreCardMetric_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
 }
 protected void SuperForm1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
     e.NewValues["Notes"] = ((Obout.Ajax.UI.HTMLEditor.Editor)((DetailsViewRow)SuperForm1.Rows[14]).FindControl("Editor1")).Content;
 }
Пример #51
0
 protected void DetailsView1_ItemUpdating(object sender,
                                          DetailsViewUpdateEventArgs e)
 {
     e.NewValues["UpdateDateTime"] = DateTime.Now;
 }
    protected void DetailsViewTarget_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
        TextBox test_started = (TextBox)DetailsViewTarget.FindControl("TextBox3");
        TextBox test_completed = (TextBox)DetailsViewTarget.FindControl("TextBox4");
        TextBox certification_submit_to_authority = (TextBox)DetailsViewTarget.FindControl("TextBox5");
        TextBox certification_completed = (TextBox)DetailsViewTarget.FindControl("TextBox6");
        TextBox TextBox_Actual_Lead_time = (TextBox)DetailsViewTarget.FindControl("TextBox_Actual_Lead_time");
        TextBox textBoxEstimated = (TextBox)DetailsViewTarget.FindControl("TextBoxEstimated");
        TextBox txtProcess = (TextBox)DetailsViewTarget.FindControl("txtProcess"); //2013/5/6 新增需求

        decimal wk = 0;
        //if (!string.IsNullOrEmpty(test_started.Text) && !string.IsNullOrEmpty(certification_completed.Text))
        //{
        //  DateTime dt_test_started = DateTime.Parse(test_started.Text);
        //  DateTime dt_certification_completed = DateTime.Parse(certification_completed.Text);
        //  wk = Math.Ceiling(decimal.Parse(dt_certification_completed.Subtract(dt_test_started).Days.ToString()) / 7);
        //  TextBox_Actual_Lead_time.Text = wk.ToString();
        //}
        //else if (!string.IsNullOrEmpty(test_started.Text) && !string.IsNullOrEmpty(test_completed.Text))
        //{
        //  DateTime dt_test_started = DateTime.Parse(test_started.Text);
        //  DateTime dt_test_completed = DateTime.Parse(test_completed.Text);
        //  wk = Math.Ceiling(decimal.Parse(dt_test_completed.Subtract(dt_test_started).Days.ToString()) / 7);
        //  TextBox_Actual_Lead_time.Text = wk.ToString();
        //}
        //else if (!string.IsNullOrEmpty(certification_submit_to_authority.Text) && !string.IsNullOrEmpty(certification_completed.Text))
        //{
        //  DateTime dt_certification_submit_to_authority = DateTime.Parse(certification_submit_to_authority.Text);
        //  DateTime dt_certification_completed = DateTime.Parse(certification_completed.Text);
        //  wk = Math.Ceiling(decimal.Parse(dt_certification_completed.Subtract(dt_certification_submit_to_authority).Days.ToString()) / 7);
        //  TextBox_Actual_Lead_time.Text = wk.ToString();
        //}
        if (!string.IsNullOrEmpty(txtProcess.Text) && !string.IsNullOrEmpty(certification_completed.Text))
        {
          DateTime dt_txtProcess = DateTime.Parse(txtProcess.Text);
          DateTime dt_certification_completed = DateTime.Parse(certification_completed.Text);
          wk = Math.Ceiling(decimal.Parse(dt_certification_completed.Subtract(dt_txtProcess).Days.ToString()) / 7);
          TextBox_Actual_Lead_time.Text = wk.ToString();
        }
        SqlDataSourceModifyTarget.UpdateParameters["Actual_Lead_time"].DefaultValue = wk.ToString();

        //DropDownList ddlAgent = (DropDownList)DetailsViewTarget.FindControl("DropDownListAgent");
        //SqlDataSourceModifyTarget.UpdateParameters["Agent"].DefaultValue = ddlAgent.SelectedValue;

        DropDownList ddlEmp = (DropDownList)DetailsViewTarget.FindControl("DropDownListEmp");
        SqlDataSourceModifyTarget.UpdateParameters["Country_Manager"].DefaultValue = ddlEmp.SelectedValue;

        if (!string.IsNullOrEmpty(textBoxEstimated.Text))
        {
          // Actual > Estimated 則屬逾時
          if (int.Parse(wk.ToString()) > int.Parse(textBoxEstimated.Text))
          {
        SqlDataSourceModifyTarget.UpdateParameters["Status"].DefaultValue = "Delay";
          }
          else
          {
        DropDownList ddlStatus = (DropDownList)DetailsViewTarget.FindControl("ddlStatus");
        SqlDataSourceModifyTarget.UpdateParameters["Status"].DefaultValue = ddlStatus.SelectedValue;
          }
        }
        else
        {
          DropDownList ddlStatus = (DropDownList)DetailsViewTarget.FindControl("ddlStatus");
          SqlDataSourceModifyTarget.UpdateParameters["Status"].DefaultValue = ddlStatus.SelectedValue;
        }
    }
Пример #53
0
        protected void dvLearner_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
        {
            string _membPwd = "", _membFirstName = "", _membLastName = "", _membEmail = "";

            // ensure all mandatory fields were entered
            if (se.usesPassword)
            {
                TextBox txtMembPwd = (TextBox)dvLearner.FindControl("membPwd"); _membPwd = txtMembPwd.Text.Trim();
            }
            TextBox txtMembFirstName = (TextBox)dvLearner.FindControl("membFirstName"); _membFirstName = txtMembFirstName.Text.Trim();
            TextBox txtMembLastName  = (TextBox)dvLearner.FindControl("membLastName"); _membLastName = txtMembLastName.Text.Trim();
            TextBox txtMembEmail     = (TextBox)dvLearner.FindControl("membEmail"); _membEmail = txtMembEmail.Text.Trim();

            string missingFields = "";

            if (se.usesPassword)
            {
                if (_membPwd.Length == 0)
                {
                    missingFields += " Password,";
                }
            }
            if (_membFirstName.Length == 0)
            {
                missingFields += " First Name,";
            }
            if (_membLastName.Length == 0)
            {
                missingFields += " Last Name,";
            }
            if (_membEmail.Length == 0)
            {
                missingFields += " Email,";
            }
            if (missingFields.Length > 0)
            {
                labError.Text    = "<p />You are missing mandatory field(s): " + missingFields.TrimEnd(',') + ".";
                labError.Visible = true;
                e.Cancel         = true;
            }

            // for some reason I need to force this value into membLevel
            DropDownList ctrMembLevel = (DropDownList)dvLearner.FindControl("membLevel");

            e.NewValues["membLevel"] = ctrMembLevel.SelectedValue;

            // create single string for managerAccess display
            ListBox ctrMembManagerAccess = (ListBox)dvLearner.FindControl("membManagerAccess");
            string  membManagerAccess    = null;

            foreach (ListItem item in ctrMembManagerAccess.Items)
            {
                if (item.Selected)
                {
                    membManagerAccess += item.Value + ",";
                }
            }
            if (membManagerAccess != null)
            {
                membManagerAccess = membManagerAccess.TrimEnd(',');
            }
            e.NewValues["membManagerAccess"] = membManagerAccess;
        }
Пример #54
0
 protected void DetailsView1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
     e.NewValues["UpdateDateTime"] = DateTime.Now;
 }
 protected void DetailsView1_ItemUpdating1(object sender, DetailsViewUpdateEventArgs e)
 {
 }
 protected void SuperForm1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
     e.NewValues["ShipCountry"] = ((Obout.ListBox.ListBox)((DetailsViewRow)SuperForm1.Rows[4]).FindControl("ShipCountry")).SelectedValue;
 }
Пример #57
0
 protected void dvDevice_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
 {
     e.Cancel = DeviceExists(e.NewValues["IMEI"].ToString(), (int)e.Keys["Id"]);
 }