//protected void grv_b_RowCreated(object sender, GridViewRowEventArgs e)
    //{
    //    if (e.Row.RowType == DataControlRowType.Header)
    //    {
    //        e.Row.Cells[3].Text = "监测项目";

    //        TableCell headerDetail = new TableCell();
    //        headerDetail.Text = "分析方法选择";
    //        headerDetail.BackColor = System.Drawing.Color.FromArgb(227, 239, 255);
    //        headerDetail.Width = 600;
    //        e.Row.Cells.Add(headerDetail);

    //    }
    //    if (e.Row.RowType == DataControlRowType.DataRow)
    //    {
    //        //鼠标移动到每项时颜色交替效果
    //        e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='';");
    //        e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#00ffee'");
    //        //int id = e.Row.RowIndex + 1;

    //        //e.Row.Cells[0].Text = id.ToString();

    //        //手动添加详细和删除按钮
    //        TableCell tabcDetail = new TableCell();

    //        tabcDetail.Style.Add("text-align", "center");
    //        RadioButtonList ibtnDetail = new RadioButtonList();
    //        ibtnDetail.ID = "cbl";
    //        ibtnDetail.SelectedIndex = 0;
    //        tabcDetail.Controls.Add(ibtnDetail);
    //        e.Row.Cells.Add(tabcDetail);
    //    }
    //    if (e.Row.RowType != DataControlRowType.Pager)
    //    {
    //        ////绑定数据后,隐藏4,5,6,7列
    //        e.Row.Cells[1].Visible = false;
    //        e.Row.Cells[2].Visible = false;


    //    }
    //}
    //protected void grv_b_RowDataBound(object sender, GridViewRowEventArgs e)
    //{
    //    if (e.Row.RowType == DataControlRowType.DataRow)
    //    {
    //        if (e.Row.Cells[1].Text.Trim() != " ")
    //        {
    //            DataTable Method = itemObj.GetMethod(e.Row.Cells[1].Text.Trim());//dtItem.Select("ClassID='" + e.Row.Cells[1].Text.Trim() + "'");
    //            RadioButtonList cbl_temp = e.Row.Cells[4].FindControl("cbl") as RadioButtonList;
    //            cbl_temp.RepeatDirection = RepeatDirection.Vertical;
    //            cbl_temp.DataSource = Method;
    //            cbl_temp.DataValueField = "id";
    //            cbl_temp.DataTextField = "Standard";
    //            cbl_temp.DataBind();
    //        }
    //    }
    //}


    protected void btn_save_b_OnClick(object sender, EventArgs e)
    {
        DAl.User.Users    userobj    = new DAl.User.Users();
        Entity.User.Users userentity = new Entity.User.Users();

        userentity.UserID = txt_UserName.Text;
        for (int p = 0; p < Repeater_B.Items.Count; p++)
        {
            CheckBoxList cbl_ItemlistB = Repeater_B.Items[p].FindControl("cbl_ItemlistB") as CheckBoxList;
            //TBD AB角信息初始化
            for (int i = 0; i < cbl_ItemlistB.Items.Count; i++)
            {
                if (cbl_ItemlistB.Items[i].Selected)
                {
                    Entity.SampleItem item = new Entity.SampleItem();
                    item.MonitorID   = int.Parse(cbl_ItemlistB.Items[i].Value);
                    item.MonitorItem = cbl_ItemlistB.Items[i].Text.Trim();

                    userentity.AitemList.Add(item);
                }
            }
        }
        //保存用户AB角
        if (userobj.SaveAB(userentity, "B") == 1)
        {
            Repeater_B.Visible = false;
            btn_b_add.Text     = "+分析员B角设定";
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('B角设定成功!');", true);
            ABRoleGroup(userentity.UserID);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('B角设定失败!');", true);
        }
    }
    //选中某个报告,某个报告的样品单列表
    protected void grdvw_List_RowSelecting(object sender, GridViewSelectEventArgs e)
    { //指派给谁
        DropDownList drp_zpto = grdvw_List.Rows[e.NewSelectedIndex].FindControl("drp_zpto") as DropDownList;

        if (drp_zpto.SelectedValue.ToString() != "0")
        {
            List <Entity.SampleItem> entitylist = new List <Entity.SampleItem>();
            Entity.SampleItem        entity     = new Entity.SampleItem();
            entity.SampleID = grdvw_List.Rows[e.NewSelectedIndex].Cells[16].Text.Trim().ToString();           //样品编号
            entity.ID       = int.Parse(grdvw_List.Rows[e.NewSelectedIndex].Cells[1].Text.Trim().ToString()); //监测项记录ID


            entity.zpto     = drp_zpto.SelectedValue.ToString();
            entity.statusID = 1;
            //指派人
            entity.zpcreateuser = Request.Cookies["Cookies"].Values["u_id"].ToString();
            //指派时间
            entity.zpdate = DateTime.Now;
            entitylist.Add(entity);
            DAl.DrawSample itemObj = new DAl.DrawSample();
            if (itemObj.ZPSampleItem(entitylist) == 1)
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('指派保存成功!')", true);
                ReportQuery();
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('指派保存失败!')", true);
            }
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('分析人未指定!')", true);
        }
    }
    protected void btn_save_b_OnClick(object sender, EventArgs e)
    {
        DAl.User.Users    userobj    = new DAl.User.Users();
        Entity.User.Users userentity = new Entity.User.Users();

        userentity.UserID = txt_UserName.Text;
        //TBD AB角信息初始化
        for (int i = 0; i < cbl_ItemlistB.Items.Count; i++)
        {
            if (cbl_ItemlistB.Items[i].Selected)
            {
                Entity.SampleItem item = new Entity.SampleItem();
                item.TypeID      = int.Parse(drop_type_b.SelectedValue.ToString().Trim());
                item.MonitorID   = int.Parse(cbl_ItemlistB.Items[i].Value);
                item.MonitorItem = cbl_ItemlistB.Items[i].Text.Trim();
                userentity.AitemList.Add(item);
            }
        }

        //保存用户AB角
        if (userobj.SaveAB(userentity, "B", drop_type_b.SelectedValue.ToString().Trim()) == 1)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('B角设定成功!');", true);
            panel_b.Visible = false;
            ABRoleGroup(userentity.UserID);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('B角设定失败!');", true);
        }
    }
    protected void btn_zp_Click(object sender, EventArgs e)
    {
        int i = 0;
        int j = 0;

        foreach (GridViewRow gvr in grdvw_List.Rows)
        {
            System.Web.UI.WebControls.CheckBox cbl = gvr.FindControl("cbl") as System.Web.UI.WebControls.CheckBox;
            if (cbl.Checked)
            {
                i++;
                //指派给谁
                DropDownList drp_zpto = gvr.FindControl("drp_zpto") as DropDownList;
                if (drp_zpto.SelectedValue.ToString() != "0")
                {
                    List <Entity.SampleItem> entitylist = new List <Entity.SampleItem>();
                    Entity.SampleItem        entity     = new Entity.SampleItem();
                    entity.SampleID = gvr.Cells[16].Text.Trim().ToString();           //样品编号
                    entity.ID       = int.Parse(gvr.Cells[1].Text.Trim().ToString()); //监测项记录ID


                    entity.zpto     = drp_zpto.SelectedValue.ToString();
                    entity.statusID = 1;
                    //指派人
                    entity.zpcreateuser = Request.Cookies["Cookies"].Values["u_id"].ToString();
                    //指派时间
                    entity.zpdate = DateTime.Now;
                    entitylist.Add(entity);
                    DAl.DrawSample itemObj = new DAl.DrawSample();
                    if (itemObj.ZPSampleItem(entitylist) == 1)
                    {
                        j++;
                    }
                }
            }
        }
        if (i == j && j > 0)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('指派保存成功!')", true);
            ReportQuery();
        }
        else if (i > j && j > 0)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('部分指派保存成功!请查看分析人员是否选择?')", true);
            ReportQuery();
        }
        else if (i == 0)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('请勾选指派记录!')", true);
        }
        else if (j == 0)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('请查看分析人员是否选择?')", true);
        }
    }
    protected void btn_save_b_OnClick(object sender, EventArgs e)
    {
        DAl.User.Users    userobj    = new DAl.User.Users();
        Entity.User.Users userentity = new Entity.User.Users();

        userentity.UserID = txt_UserName.Text;
        for (int p = 0; p < Repeater_B.Items.Count; p++)
        {
            GridView grv_b = Repeater_B.Items[p].FindControl("grv_b") as GridView;
            //TBD AB角信息初始化
            for (int i = 0; i < grv_b.Rows.Count; i++)
            {
                CheckBox cb = grv_b.Rows[i].Cells[0].FindControl("autoid") as CheckBox;
                if (cb.Checked)
                {
                    Entity.SampleItem item = new Entity.SampleItem();
                    item.MonitorID   = int.Parse(grv_b.Rows[i].Cells[1].Text.Trim());
                    item.MonitorItem = grv_b.Rows[i].Cells[3].Text.Trim();
                    RadioButtonList cbl = grv_b.Rows[i].Cells[4].FindControl("cbl") as RadioButtonList;
                    for (int j = 0; j < cbl.Items.Count; j++)
                    {
                        if (cbl.Items[j].Selected)
                        {
                            item.Method = cbl.Items[j].Value.Trim();
                        }
                    }
                    userentity.AitemList.Add(item);
                }
            }
        }
        //保存用户AB角
        if (userobj.SaveAB(userentity, "B") == 1)
        {
            Repeater_B.Visible = false;
            btn_b_add.Text     = "+分析员B角设定";
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('B角设定成功!');", true);
            ABRoleGroup(userentity.UserID);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('B角设定失败!');", true);
        }
    }
Beispiel #6
0
    protected void btn_Draw_Click(object sender, EventArgs e)
    {
        List <Entity.SampleItem> DrawList = new List <Entity.SampleItem>();

        foreach (GridViewRow gvr in grdvw_List.Rows)
        {
            if (gvr.RowType == DataControlRowType.DataRow)
            {
                CheckBox cbl = gvr.Cells[0].FindControl("cbl") as CheckBox;
                if (cbl.Checked)
                {
                    Entity.SampleItem temp = new Entity.SampleItem();
                    temp.Lydate    = DateTime.Now;
                    temp.LyUser    = Request.Cookies["Cookies"].Values["u_id"].ToString();
                    temp.SampleID  = gvr.Cells[19].Text.Trim();
                    temp.ID        = int.Parse(gvr.Cells[1].Text.Trim());
                    temp.MonitorID = int.Parse(gvr.Cells[2].Text.Trim());
                    DrawList.Add(temp);
                }
            }
        }
        if (DrawList.Count > 0)
        {
            DAl.DrawSample drawobj = new DAl.DrawSample();
            if (drawobj.AddDraw(DrawList) > 0)
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('领样成功!')", true);
                Query();
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('领样失败!')", true);
            }
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('请选择要领取的监测项!')", true);
        }
    }
Beispiel #7
0
    protected void btn_OK_Click(object sender, EventArgs e)
    {
        string[] strlist       = new string[3 + grv_itemlist.Rows.Count];
        string   sampleID      = strSelectedId;
        string   itemlist      = "";
        string   itemValuelist = "";
        int      j             = 0;

        DateTime lydate = DateTime.Now;
        bool     flag   = false;

        Entity.Draw entity = new Entity.Draw();
        entity.ID       = int.Parse(strDrawId);
        entity.SampleID = sampleID;
        entity.LyDate   = DateTime.Now;
        entity.UserID   = Request.Cookies["Cookies"].Values["u_id"].ToString();
        //string getitemstr = "select AIName,MonitorItem from t_MonitorItemDetail inner join t_M_AnalysisItemEx on t_M_AnalysisItemEx.id=t_MonitorItemDetail.MonitorItem inner join t_DrawSample  on t_DrawSample.id=t_MonitorItemDetail.FxDanID where t_DrawSample.SampleID='" + sampleID + "' and fxuser='******' and t_DrawSample.flag=0";
        //DataSet dsitem = new MyDataOp(getitemstr).CreateDataSet();
        //foreach (DataRow dr in dsitem.Tables[0].Rows)
        //{
        //    itemlist += dr["AIName"].ToString() + ",";
        //    itemValuelist += dr["MonitorItem"].ToString() + ",";
        //}
        //更新分析项目状态为分析中
        for (int i = 0; i < grv_itemlist.Rows.Count; i++)
        {
            CheckBox          cbl    = (CheckBox)grv_itemlist.Rows[i].FindControl("cb_id");
            RadioButtonList   rbl    = (RadioButtonList)grv_itemlist.Rows[i].FindControl("cbl_item");
            string            aiid   = grv_itemlist.Rows[i].Cells[1].Text.Trim();
            string            ainame = grv_itemlist.Rows[i].Cells[2].Text.Trim();
            Entity.SampleItem item   = new Entity.SampleItem();
            item.MonitorID = int.Parse(aiid);
            item.SampleID  = sampleID;
            if (cbl.Checked)
            {
                flag = true;
                if (!itemlist.Contains(ainame + ","))
                {
                    itemlist      += ainame + ",";
                    itemValuelist += aiid + ",";
                }

                item.flag = true;

                entity.status = 0;
                item.Method   = rbl.SelectedValue;
                entity.SampleItemList.Add(item);
                item = null;
            }
        }
        entity.ItemList      = itemlist;
        entity.ItemValueList = itemValuelist;
        if (flag)
        {
            DAl.DrawSample DrawSampleobj = new DAl.DrawSample();
            int            returnID      = 0;
            if (strDrawId == "0")
            {
                returnID = DrawSampleobj.AddDrawSample(entity);
            }
            else
            {
                returnID = DrawSampleobj.EditDrawSample(entity);
            }
            if (returnID > 0)
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "clickAddSuccess", "alert('样品领用保存成功!');unshowDraw();", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "clickAddUnSuccess", "alert('样品领用保存失败!')", true);
            }
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "clickAddUnSuccess", "alert('请选择本次领样要分析的项目!')", true);
        }
        DrawList();
        Query();
    }
    protected void btn_print_Click(object sender, EventArgs e)
    {
        int NO = 1;

        if (txt_NO.Text.Trim() != "")
        {
            try
            {
                NO = int.Parse(txt_NO.Text);
                if (NO > 8)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", " alert('标签开始项输入有误');", true);
                    return;
                }
            }
            catch
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", " alert('标签开始项输入有误');", true);
                return;
            }
        }
        List <Entity.Sample> SampleList = new List <Entity.Sample>();
        int num   = 48;
        int start = 0;
        int end   = grv_dayin.Rows.Count;

        if (txt_SNum.Text.Trim() != "" && txt_eNum.Text.Trim() != "")
        {
            start = int.Parse(txt_SNum.Text.Trim());
            end   = int.Parse(txt_eNum.Text.Trim());
        }
        int p = 1;

        foreach (GridViewRow gvr in grv_dayin.Rows)
        {
            if (p >= start && p <= end)
            {
                System.Web.UI.WebControls.CheckBox cb = gvr.Cells[0].FindControl("cb") as System.Web.UI.WebControls.CheckBox;
                if (start != 0)
                {
                    cb.Checked = true;
                }
                if (cb.Checked)
                {
                    Entity.Sample entity = new Entity.Sample();
                    if (gvr.Cells[1].Text.Trim() != "&nbsp;")
                    {
                        entity.SampleID = gvr.Cells[1].Text.Trim();
                    }
                    if (gvr.Cells[2].Text.Trim() != "&nbsp;")
                    {
                        entity.projectname = gvr.Cells[2].Text.Trim();
                    }
                    if (gvr.Cells[3].Text.Trim() != "&nbsp;")
                    {
                        entity.SampleDate = DateTime.Parse(gvr.Cells[3].Text.Trim());
                    }

                    if (gvr.Cells[5].Text.Trim() != "&nbsp;")
                    {
                        entity.SampleProperty += gvr.Cells[5].Text.Trim();
                    }
                    else
                    {
                        entity.SampleProperty = "";
                    }
                    string   itemstr  = gvr.Cells[12].Text.Trim();
                    string[] itemlist = itemstr.Split(',');
                    if (itemlist.Length > 13)
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", " alert('监测项数不能大于12项');", true);
                        return;
                    }
                    for (int i = 0; i < itemlist.Length; i++)
                    {
                        if (itemlist[i] != "")
                        {
                            Entity.SampleItem item = new Entity.SampleItem();
                            item.Remark = itemlist[i];
                            entity.SampleItemList.Add(item);
                        }
                    }
                    if (entity.SampleItemList.Count > 0)
                    {
                        SampleList.Add(entity);
                    }
                }
            }
            p++;
        }
        if (SampleList.Count > 0)
        {
            num = SampleList.Count;
            if (NO - 1 + num <= 48)
            {
                print(SampleList, NO - 1);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", " alert('标签打印不能超过6页纸!');", true);
                return;
            }
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", " alert('请选择需要打印的标签!');", true);
            return;
        }
    }
    //提交分析项目,登记分析单数据,更细领用分析标志位
    protected void btn_Commit_Click(object sender, EventArgs e)
    {
        if (txt_jhdate.Text.Trim() == "")
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Success", "alert('校核时间不能为空!');", true);
            return;
        }
        else if (txt_jhman.Text.Trim() == "")
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Success", "alert('校核人员不能为空!');", true);
        }
        else
        {
            Entity.Draw draw = new Entity.Draw();
            draw.SampleID   = strSampleID;
            draw.ID         = int.Parse(strNowLyID);
            draw.finishdate = DateTime.Now;
            draw.jhman      = txt_jhman.Text;
            draw.jhtime     = DateTime.Parse(txt_jhdate.Text.Trim());
            draw.fxman      = Request.Cookies["Cookies"].Values["u_id"].ToString().Trim();

            foreach (GridViewRow gr in grdvw_ReportDetail.Rows)
            {
                Entity.SampleItem item = new Entity.SampleItem();
                if (gr.Cells[1].Text.Trim() != "")
                {
                    item.ID = int.Parse(gr.Cells[1].Text.Trim());

                    TextBox txt_value = gr.Cells[7].FindControl("txt_value") as TextBox;

                    if (txt_value.Text.Trim() != "")
                    {
                        DateTime time = DateTime.Now;
                        if (gr.Cells[6].Text.Trim() != "&nbsp;" && gr.Cells[6].Text.Trim() != "")
                        {
                            item.AnalysisDate = DateTime.Parse(gr.Cells[6].Text.Trim());
                        }
                        //item.jhdate = DateTime.Parse(txt_jhdate.Text.Trim());
                        item.Value          = txt_value.Text.Trim();
                        item.statusID       = 1;
                        item.lyID           = strNowLyID;
                        item.AnalysisUserID = Request.Cookies["Cookies"].Values["u_id"].ToString().Trim();
                        //item.jhman = txt_jhman.Text;
                        draw.SampleItemList.Add(item);
                    }
                }
                else
                {
                    item.ID = 0;
                }
            }

            if (fxlist == "&nbsp;" || draw.SampleItemList.Count == grdvw_ReportDetail.Rows.Count)
            {
                DAl.Sample sampleobj = new DAl.Sample();

                if (sampleobj.ExChangeSample(draw) > 0)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Success", "alert('分析数据提交成功!');hiddenDetailAnalysis();", true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Success", "alert('分析数据提交失败!')", true);
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Success", "alert('分析数据登记未全!不能成功提交')", true);
            }
        }
        ReportQuery();
        Query();
    }