Exemplo n.º 1
0
        public void RenderRequestPerson()
        {
            DataTable dt = get_form_data();

            if (dt.Rows.Count > 0)
            {
                DataRow dr = dt.Rows[0];

                request_person obj = new request_person();
                obj.HeadImage   = GData.get_user_image(dr["user_id"].ToString());
                obj.Name        = GData.get_user_name(dr["user_id"].ToString());
                obj.StatusClass = GData.get_status_class(dr["status"].ToString());
                obj.StatusText  = GData.get_status_name(dr["status"].ToString());
                Gwork_follow_content.Controls.Add(obj);


                H5Div detail_message = new H5Div();
                detail_message.CssClass = "detail_message";
                Gwork_follow_content.Controls.Add(detail_message);

                List <H5Columns> list_column = H5Column;
                foreach (H5Columns item in list_column)
                {
                    detail_message_item c = new detail_message_item();
                    c.Key = item.HC_DESC;
                    if (item.HC_CONTROL_TYPE == "H5Date")
                    {
                        if (!string.IsNullOrEmpty(dr[item.HC_NAME].ToString()))
                        {
                            c.Value = Convert.ToDateTime(dr[item.HC_NAME].ToString()).ToString("yyyy-MM-dd");
                        }
                    }

                    if (item.HC_CONTROL_TYPE == "H5DateTime")
                    {
                        if (!string.IsNullOrEmpty(dr[item.HC_NAME].ToString()))
                        {
                            c.Value = Convert.ToDateTime(dr[item.HC_NAME].ToString()).ToString("yyyy-MM-dd HH:mm");
                        }
                    }

                    if (string.IsNullOrEmpty(c.Value))
                    {
                        c.Value = dr[item.HC_NAME].ToString();
                    }

                    detail_message.Controls.Add(c);
                }
            }
        }
Exemplo n.º 2
0
        private DataTable get_work_follow_data()
        {
            StringBuilder       strsql    = new StringBuilder();
            List <SqlParameter> list_para = new List <SqlParameter>();
            H5Objects           o         = H5Object;

            strsql.Append("select WF_FROM_USER,WF_TO_USER,dbo.fn_convert_datetime(WF_APPROVE_DATE) as WF_APPROVE_DATE,WF_REASON,WF_STATUS from SP_WORK_FOLLOW where WF_BUSINESS_TYPE=@WF_BUSINESS_TYPE and WF_BUSINESS_KEY=@WF_BUSINESS_KEY ORDER BY WF_CREATE_DATE DESC ");
            list_para.Add(new SqlParameter("@WF_BUSINESS_TYPE", o.HO_BUSINESS_TYPE));
            list_para.Add(new SqlParameter("@WF_BUSINESS_KEY", Key));
            SqlConnection cn = comm_fun.get_cn();

            try
            {
                DataTable dt = comm_fun.GetDatatable(strsql.ToString(), cn, list_para);
                if (dt.Rows.Count > 0)
                {
                    dt.Columns.Add("WF_TO_USER_NAME");
                    dt.Columns.Add("WF_TO_USER_IMAGE");
                    dt.Columns.Add("WF_STATUS_CLASS");
                    dt.Columns.Add("WF_STATUS_TEXT");

                    foreach (DataRow dr in dt.Rows)
                    {
                        dr["WF_TO_USER_NAME"]  = GData.get_user_name(dr["WF_TO_USER"].ToString());
                        dr["WF_TO_USER_IMAGE"] = GData.get_user_image(dr["WF_TO_USER"].ToString());
                        dr["WF_STATUS_CLASS"]  = GData.get_status_class(dr["WF_STATUS"].ToString());
                        dr["WF_STATUS_TEXT"]   = GData.get_status_detail_name(dr["WF_STATUS"].ToString());
                    }
                }

                if (dt.Rows.Count == 1)
                {
                    DataRow dr           = dt.Rows[0];
                    string  WF_FROM_USER = dr["WF_FROM_USER"].ToString();
                    string  WF_STATUS    = dr["WF_STATUS"].ToString();
                    if (WF_FROM_USER == Cookies.UserCode && WF_STATUS == "0" && CancleAble)
                    {
                        CancleAble = true;
                    }
                    else
                    {
                        CancleAble = false;
                    }
                }
                else
                {
                    CancleAble = false;
                }

                if (dt.Rows.Count > 0)
                {
                    DataRow dr         = dt.Rows[0];
                    string  WF_TO_USER = dr["WF_TO_USER"].ToString();
                    string  WF_STATUS  = dr["WF_STATUS"].ToString();
                    if (WF_TO_USER == Cookies.UserCode && WF_STATUS == "0" && ApproveAble)
                    {
                        ApproveAble = true;
                    }
                    else
                    {
                        ApproveAble = false;
                    }
                }
                return(dt);
            }
            catch (Exception ex)
            {
                comm_fun.WriteLog(ex.ToString());
            }
            finally
            {
                comm_fun.CloseConnection(cn);
            }

            return(new DataTable());
        }