Beispiel #1
0
    //还样
    protected void grdvw_ReportDetail_RowEditing(object sender, GridViewEditEventArgs e)
    {
        strDrawId = grdvw_ReportDetail.Rows[e.NewEditIndex].Cells[1].Text.Trim();
        Entity.Draw entity = new Entity.Draw();
        entity.ID         = int.Parse(strDrawId);
        entity.SampleID   = strSelectedId;
        entity.returndate = DateTime.Now.ToString();
        entity.UserID     = Request.Cookies["Cookies"].Values["u_id"].ToString();
        TextBox txt_remark = grdvw_ReportDetail.Rows[e.NewEditIndex].Cells[7].FindControl("txt_Remark") as TextBox;

        entity.Remark = txt_remark.Text.Trim();


        DAl.DrawSample DrawSampleobj = new DAl.DrawSample();
        if (DrawSampleobj.ReturnSample(entity) > 0)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "clickAddSuccess", "alert('还样保存成功!');hiddenDetail();", true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "clickAddUnSuccess", "alert('还样保存失败!')", true);
        }
        DrawReList();
        Query();
    }
Beispiel #2
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_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();
    }