protected void apply_form_link_Click(object sender, EventArgs e) { Control button = sender as Control; SysUserInfo curr_user = this.GetCurrentUserInfo(); string form_Id = (button.NamingContainer.FindControl("hidden_form_id") as HiddenField).Value; #region add to form_header //FormHeader header = new FormHeader(form_Id, form_no); //header.FormDate = DateTime.Now; //header.FormDueDate = DateTime.Now; //header.FormFiller = curr_user.UserId; //header.SiteSerial = curr_user.SiteSerial; //header.Status = FormStatus.NC; //FormHeaderBiz.InsertFormHeader(header); #endregion FormInfo form = FormBiz.GetForm(int.Parse(form_Id)); string apply_url = form.ApplyUrl; if (string.IsNullOrEmpty(apply_url)) { throw new ApplicationException(string.Format("form kind ({0})'s apply_url not set.", form_Id)); } StringBuilder sb = new StringBuilder(150); sb.Append(apply_url); //sb.Append(apply_url.Contains("?") ? "&" : "?"); //sb.AppendFormat("form_no={0}", form_no); Response.Redirect("transferframe.aspx"); }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { HiddenField hidden_form_no = e.Row.FindControl("hidden_form_no") as HiddenField; if (hidden_form_no != null) { string app_status = DataBinder.Eval(e.Row.DataItem, "AppStatus").ToString(); int form_Id = Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "FormId")); int form_no = int.Parse(hidden_form_no.Value); FormInfo form_obj = FormBiz.GetForm(form_Id); if (form_obj == null) { throw new ApplicationException(string.Format("form kind ({0}) does not exists.", form_Id)); } HyperLink hyperlink_view = e.Row.FindControl("hyperlink_view") as HyperLink; if (app_status == FormStatus.NC || app_status == FormStatus.DE) { hyperlink_view.Visible = false; } else { hyperlink_view.Visible = true; string view_url = form_obj.ViewUrl; if (string.IsNullOrEmpty(view_url)) { throw new ApplicationException(string.Format("form kind ({0}), view_url not set.", form_Id)); } if (view_url.Contains("?")) { view_url = string.Format("{0}&form_no={1}", view_url, form_no); } else { view_url = string.Format("{0}?form_no={1}", view_url, form_no); } hyperlink_view.NavigateUrl = view_url; } Label label_form_id = e.Row.FindControl("label_form_id") as Label; if (label_form_id != null) { label_form_id.Text = FormBiz.GetForm(form_Id).FormName; } ImageButton button_approvelist = e.Row.FindControl("button_approve_list") as ImageButton; string script = string.Format("showApproveList({0},{1})", DataBinder.Eval(e.Row.DataItem, "FormId"), DataBinder.Eval(e.Row.DataItem, "FormNo")); button_approvelist.Attributes.Add("onclick", script); } Label label_apply_user = e.Row.FindControl("label_apply_user") as Label; if (label_apply_user != null) { //string user_id = DataBinder.Eval(e.Row.DataItem, "Applyer").ToString(); //label_apply_user.Text = UserBiz.GetUser(user_id).LoginName; } Label label_approve_status = e.Row.FindControl("label_approve_status") as Label; if (label_approve_status != null) { string status = DataBinder.Eval(e.Row.DataItem, "AppStatus").ToString(); //label_approve_status.Text = FormStatus.GetStatusFullName(status); } }