Пример #1
0
    public bool UpdateAprvlRecord(WorkOrder.WOapprovalRow woDataRow)
    {
        //DateTime dt_WOdatetime = Convert.ToDateTime(woDataTbl.Columns["wapr_AprvDate"]);
        //if (woDataTbl.Columns["wapr_AprvDate"] == null) dt_WOdatetime = DateTime.Now;
        WorkOrder.WOapprovalDataTable woDataTbl = new WorkOrder.WOapprovalDataTable(); //WOApprovaladapter.GetWOapprovalByAprvNum(Convert.ToInt32(woDataRow.wapr_AprvNum));
        woDataTbl.AddWOapprovalRow(woDataRow);
        //for (int i = 0; i < woDataRow.ItemArray.Length; i++)
        //{
        //    woDataTbl.Rows[0].ItemArray[i] = woDataRow.ItemArray[""];
        //}



        int rowsAffected = WOApprovaladapter.Update(woDataTbl);


        //.UpdateApprovalRecord(Convert.ToInt32(woDataRow.ItemArray["wapr_AprvNum"]),
        //Convert.ToInt32(woDataRow.ItemArray["wapr_WOnum"]), woDataRow.ItemArray["wapr_Proj"].ToString(),
        //Convert.ToDateTime(woDataRow.ItemArray["wapr_AprvDate"]), Convert.ToInt32(woDataRow.ItemArray["wapr_Approver"]),
        //Convert.ToBoolean(woDataRow.ItemArray["wapr_AprvCode"]), Convert.ToDateTime(woDataRow.ItemArray["wapr_AprvlDate"]),
        //woDataRow.ItemArray["wapr_comments"].ToString(), Convert.ToBoolean(woDataRow.ItemArray["wapr_required"]),
        //Convert.ToBoolean(woDataRow.ItemArray["wapr_emailFlag"]), Convert.ToInt32(woDataRow.ItemArray["wapr_AprvNum"]));

        return(rowsAffected == 1);
    }
Пример #2
0
    protected void lnkBtnReturn_Click(object sender, EventArgs e)
    {
        bool          lb_complete = true;
        woApprovalBLL apprvLogic  = new woApprovalBLL();

        WorkOrder.WOapprovalDataTable aprvDT = apprvLogic.GetWOApprovalDataByWOandProj(li_wonum, ls_proj);

        foreach (WorkOrder.WOapprovalRow aprvDR in aprvDT)
        {
            lb_complete = true;
            if (Convert.ToBoolean(aprvDR["wapr_required"]) && !Convert.ToBoolean(aprvDR["wapr_AprvCode"]))
            {
                lb_complete = false;
                break;
            }
        }

        if (lb_complete)
        {
            woPhaseBLL woPhaseLogic = new woPhaseBLL();

            int PhaseNum = woPhaseLogic.InsertPhaseRecord(li_wonum,
                                                          ls_proj, 0, DateTime.Now, "GONG", 1,
                                                          Convert.ToInt32(User.Identity.Name.Substring(User.Identity.Name.IndexOf("\\") + 1)));

            if (PhaseNum > 0)
            {
                PhaseNum = woPhaseLogic.InsertPhaseRecord(li_wonum,
                                                          ls_proj, 0, DateTime.Now, "IMPL", 0,
                                                          Convert.ToInt32(User.Identity.Name.Substring(User.Identity.Name.IndexOf("\\") + 1)));


                WorkOrderBLL woLogic = new WorkOrderBLL();
                WorkOrder.WorkOrderDataTable WrkOrds = woLogic.GetWorkOrdersByWOnumProj(li_wonum, ls_proj);
                WorkOrder.WorkOrderRow       WrkOrd  = WrkOrds[0];

                bool lb_rtn;

                WrkOrd.word_Status   = "IMPL";
                WrkOrd.word_statFlag = 0;
                WrkOrd.word_StatNum  = PhaseNum;

                lb_rtn = woLogic.UpdateWorkOrder(WrkOrd.word_WOnum, WrkOrd.word_Proj, WrkOrd.word_StatNum,
                                                 WrkOrd.word_Status, WrkOrd.word_statFlag, WrkOrd.word_Date, WrkOrd.word_Author,
                                                 WrkOrd.word_Title, "", "", WrkOrd.word_Priority,
                                                 WrkOrd.word_Descr, WrkOrd.word_Justify, WrkOrd.word_Cmnts, WrkOrd.word_PMorSME,
                                                 WrkOrd.word_BusnOwner, WrkOrd.word_reqDueDate, WrkOrd.word_WOnum, WrkOrd.word_Proj);
            }
        }

        string ls_response = "~/WorkOrder/EditWO.aspx?word_WOnum=" + li_wonum.ToString() + "&word_Proj=" + ls_proj;

        Response.Redirect(ls_response);
    }
Пример #3
0
    protected void GridView2_DataBound(object sender, EventArgs e)
    {
        DataView      dv = (DataView)ObjectDataSource5.Select();
        int           li_val;
        int           aprvlNum;
        bool          lb_pass    = true;
        woApprovalBLL apprvLogic = new woApprovalBLL();

        string ls_val1;
        string ls_val2;
        bool   lb_rtn;

        WorkOrder.WOapprovalDataTable apprvlDT = new WorkOrder.WOapprovalDataTable(); //apprvLogic.GetWOApprovalDataByWOandProj(li_wonum, ls_proj);

        foreach (DataRow dr in dv.Table.Rows)
        {
            if (ddlParticipant.Items.Count > 0)
            {
                ls_val2 = dr["worl_uid"].ToString();

                // this code ensures the dropdownlists at the bottom of the form are mutually exclusive of each other.
                foreach (ListItem partItem in ddlParticipant.Items)
                {
                    ls_val1 = partItem.Value.ToString();

                    if (ls_val2 == ls_val1)
                    {
                        ddlParticipant.Items.Remove(partItem);
                        break;
                    }
                }
            }

            aprvlNum = apprvLogic.GetNextApprovalNum();
            lb_pass  = false;

            apprvlDT = apprvLogic.GetWOApprovalDataByWOandProj(li_wonum, ls_proj);

            // this code ensures that every approval record is created
            foreach (WorkOrder.WOapprovalRow aprvlRow in apprvlDT)
            {
                if (dr["worl_uid"].ToString() == aprvlRow["wapr_Approver"].ToString()) //If approval record exists
                {
                    lb_pass = true;
                }
            }

            if (!lb_pass)                                                                            //approval record does NOT exist so insert record . . .
            {
                if (dr["worl_aprvl"] != DBNull.Value && Convert.ToBoolean(dr["worl_aprvl"]) == true) //. . . but ONLY if AprvCode checkbox is checked
                {
                    li_val = Convert.ToInt32(dr["worl_uid"].ToString());
                    lb_rtn = apprvLogic.InsertNewWOApproval(aprvlNum, li_wonum, ls_proj, DateTime.Now,
                                                            li_val, false, DateTime.Now.AddYears(-100), "", false, true);
                }
            }
        }

        WorkOrderTableAdapters.WOapprovalTableAdapter woAprvlAdapter = new WorkOrderTableAdapters.WOapprovalTableAdapter();

        dv = (DataView)ObjectDataSource5.Select();
        apprvlDT.Clear();
        apprvlDT = apprvLogic.GetWOApprovalDataByWOandProj(li_wonum, ls_proj);

        foreach (DataRow dr in dv.Table.Rows)
        {
            foreach (WorkOrder.WOapprovalRow aprvlRow1 in apprvlDT)
            {
                if (dr["worl_uid"].ToString() == aprvlRow1["wapr_Approver"].ToString())
                {
                    aprvlRow1["wapr_required"] = Convert.ToBoolean(dr["worl_aprvl"]);

                    int li_rtn = woAprvlAdapter.UpdateApprovalRecord(Convert.ToInt32(aprvlRow1.wapr_AprvNum), Convert.ToInt32(aprvlRow1.wapr_WOnum),
                                                                     aprvlRow1.wapr_Proj.ToString(), Convert.ToDateTime(aprvlRow1.wapr_AprvDate), Convert.ToInt32(aprvlRow1.wapr_Approver),
                                                                     Convert.ToBoolean(aprvlRow1.wapr_AprvCode), Convert.ToDateTime(aprvlRow1.wapr_AprvlDate),
                                                                     aprvlRow1.wapr_comments.ToString(), Convert.ToBoolean(aprvlRow1.wapr_required), Convert.ToBoolean(aprvlRow1.wapr_emailFlag),
                                                                     Convert.ToInt32(aprvlRow1.wapr_AprvNum));
                    break;
                }
            }
        }
    }