예제 #1
0
        protected void lnkSaveSupp(object sender, EventArgs e)
        {
            PLANT         plant  = (PLANT)SessionManager.EffLocation.Plant;
            LinkButton    lnk    = (LinkButton)sender;
            string        cmdID  = lnk.CommandArgument;
            PSsqmEntities ctx    = new PSsqmEntities();
            NOTIFY        notify = null;

            foreach (RepeaterItem r in rptCustPartHeader.Items)
            {
                Repeater rd = (Repeater)r.FindControl("rptSuppPartDetail");
                lnk = (LinkButton)rd.Items[0].FindControl("lnkSaveSupp");
                if (lnk.CommandArgument == cmdID)
                {
                    RadComboBox ddl1 = (RadComboBox)rd.Items[0].FindControl("ddlQSNotify1");
                    RadComboBox ddl2 = (RadComboBox)rd.Items[0].FindControl("ddlQSNotify2");
                    HiddenField hf   = (HiddenField)rd.Items[0].FindControl("hfQSNotify");
                    notify = null;
                    if (!string.IsNullOrEmpty(hf.Value))
                    {
                        notify = SQMModelMgr.LookupNotifyRecord(ctx, Convert.ToDecimal(hf.Value));
                    }
                    if (notify == null)
                    {
                        notify = SQMModelMgr.CreateNotifyRecord(SessionManager.EffLocation.Company.COMPANY_ID, 0, SessionManager.EffLocation.Plant.PLANT_ID, TaskRecordType.SupplierQualityIncident, Convert.ToDecimal(cmdID));
                    }
                    if (ddl1.SelectedIndex < 1)
                    {
                        notify.NOTIFY_PERSON1 = null;
                    }
                    else
                    {
                        notify.NOTIFY_PERSON1 = Convert.ToDecimal(ddl1.SelectedValue);
                    }

                    if (ddl2.SelectedIndex < 1)
                    {
                        notify.NOTIFY_PERSON2 = null;
                    }
                    else
                    {
                        notify.NOTIFY_PERSON2 = Convert.ToDecimal(ddl2.SelectedValue);
                    }

                    int status = SQMModelMgr.UpdateNotifyRecord(ctx, notify);
                }
            }
        }