private GK_OA_WorkLogModel _GetModelValue() { GK_OA_WorkLogModel wlModel = new GK_OA_WorkLogModel(); FreeTextBoxControls.FreeTextBox tbxContext = (FreeTextBoxControls.FreeTextBox)(this.FormView1.Row.FindControl("ContextTextBox")); AspWebControl.Calendar dayWrited = (AspWebControl.Calendar)(this.FormView1.Row.FindControl("DayWrited")); DropDownList ddlWeather = (DropDownList)(this.FormView1.Row.FindControl("WeatherDropDownList")); DropDownList ddlMood = (DropDownList)(this.FormView1.Row.FindControl("MoodDropDownList")); wlModel.UserId = user.UserID; DateTime time; if (DateTime.TryParse(dayWrited.Value, out time)) { if (time.Year < 1800) { wlModel.DayWrited = DateTime.Now; } else { wlModel.DayWrited = time; } } else { wlModel.DayWrited = DateTime.Now; } if (!ddlMood.SelectedIndex.Equals(0)) { wlModel.Mood = ddlMood.SelectedItem.Text.Trim(); } else { wlModel.Mood = ""; } if (!ddlWeather.SelectedIndex.Equals(0)) { wlModel.Weather = ddlWeather.SelectedItem.Text.Trim(); } else { wlModel.Weather = ""; } wlModel.Context = tbxContext.Text.Trim(); return(wlModel); }
protected void grdProdDes_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { GridViewRow gvr = grdProdDes.Rows[e.RowIndex] as GridViewRow; HiddenField hdnProductDesID = gvr.FindControl("hdnEditProductDesID") as HiddenField; TextBox txtDesHeading = gvr.FindControl("txtDesHeading") as TextBox; FreeTextBoxControls.FreeTextBox txtProdDescription = gvr.FindControl("txtProdDescription") as FreeTextBoxControls.FreeTextBox; RadioButtonList rdbStatus = gvr.FindControl("rdbStatus") as RadioButtonList; SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@prodDescriptionId", hdnProductDesID.Value), new SqlParameter("@DesHeading", txtDesHeading.Text.Trim()), new SqlParameter("@prodDescription", HttpUtility.HtmlEncode(txtProdDescription.Text.Trim())), new SqlParameter("@activeflag", rdbStatus.SelectedValue), new SqlParameter("@UserID", UserInfo.GetUserInfo().userId), }; objDataAccess.DaExecNonQueryStr("UPDATE productDescription SET DesHeading = @DesHeading,prodDescription=@prodDescription,modifiedby=@UserID,modifieddate=getdate(),activeflag=@activeflag WHERE prodDescriptionId = @prodDescriptionId ", paras, CommandType.Text); grdProdDes.EditIndex = -1; BindGridProductDescription(); } catch (Exception) { } }