protected void Page_Load(object sender, EventArgs e)
        {
            Absence _absenceService = new Absence();

            if (AbsenceId != null && AbsenceId != "")
            {
                _absence = _absenceService.GetAbsenceByID(AbsenceId);
            }
            if (_absence != null && (_absence.Type == 4004))
            {
                //load view with absence information
                TextBox txtBox = FindControl("txtName") as TextBox;
                if (txtBox != null)
                {
                    txtBox.Text = _absence.CustomerID;
                }

                CustomerId = _absence.CustomerID;
                CollectionCall        _collectionCallService = new CollectionCall();
                List <CollectionCall> collectionCalls        = _collectionCallService.GetCollectionCallsByCustomerId(CustomerId, _absence.HID);
                //feed the repeater with the collection calls
                Repeater rptCollectionCalls = FindControl("rptCollectionCalls") as Repeater;

                rptCollectionCalls.DataSource = collectionCalls;
                rptCollectionCalls.DataBind();
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            //add a row to temp table with column HID and other HIDs to update
            HiddenField hids           = Page.FindControl("hdnCollectionCallBatch") as HiddenField;
            string      serializedHIDs = hids.Value;

            var                 serializer      = new JavaScriptSerializer();
            List <string>       batchHIDs       = serializer.Deserialize <List <string> >(serializedHIDs);
            string              batchHIDsString = string.Join(",", batchHIDs);
            CollectionCallBatch batch           = new CollectionCallBatch();

            batch.ID   = _absence.HID.ToString();
            batch.HIDs = batchHIDsString;

            CollectionCall _collectionCallService = new CollectionCall();

            _collectionCallService.InsertCollectionCallBatch(batch.ID, batch.HIDs);
        }
Beispiel #3
0
        public static void LoadAbsenceId(string absenceId = null, HiddenField hdnIsOnHold = null, HiddenField hdnOnHoldReason = null, RejectReasonsControl rejectionReasonCtrl = null, CreateShippingLabelControl shippingLabelCtrl = null, CollectionCallControl collectionCallCtrl = null, Exact.Web.UI.Controls.Button btnShippingLabel = null, Exact.Web.UI.Controls.Button btnCollectionCall = null)
        {
            Absence myAbsence;

            if (absenceId != null)
            {
                Absence _absenceService = new Absence();
                myAbsence = _absenceService.GetAbsenceByID(absenceId);
                btnCollectionCall.Visible = false;

                if (myAbsence.ID != null && (myAbsence.Type == 1000 || myAbsence.Type == 1002 || myAbsence.Type == 1010 || myAbsence.Type == 1012))
                {
                    if (rejectionReasonCtrl != null)
                    {
                        rejectionReasonCtrl.AbsenceId = absenceId;
                    }
                    if (shippingLabelCtrl != null)
                    {
                        shippingLabelCtrl.AbsenceId = absenceId;
                    }
                    if (btnShippingLabel != null)
                    {
                        btnShippingLabel.Visible = false;
                        if (myAbsence.Type == 1002 || myAbsence.Type == 1012)
                        {
                            if (myAbsence.Status != 2)
                            {
                                btnShippingLabel.Visible = true;
                            }
                        }
                    }
                }
                else
                {
                    btnShippingLabel.Visible = false;
                }

                if (hdnIsOnHold != null && hdnOnHoldReason != null)
                {
                    if (myAbsence.AccountVinOnHold)
                    {
                        hdnIsOnHold.Value     = true.ToString();
                        hdnOnHoldReason.Value = myAbsence.AccountVinHoldReason;
                    }
                }

                //if absence is a Collection Call, and the status is not yet processed
                if (myAbsence.ID != null && myAbsence.Type == 4004)
                {
                    if (collectionCallCtrl != null)
                    {
                        collectionCallCtrl.AbsenceId = absenceId;
                        CollectionCall        _collectionCallService = new CollectionCall();
                        List <CollectionCall> otherCollectionCalls   = _collectionCallService.GetCollectionCallsByCustomerId(myAbsence.CustomerID, myAbsence.HID);
                        if (btnCollectionCall != null)
                        {
                            //show collection call
                            btnCollectionCall.Visible = false;
                            if (myAbsence.Status != 3)
                            {
                                //hide collection call
                                btnCollectionCall.Visible = true;
                            }
                            if (otherCollectionCalls == null || otherCollectionCalls.Count <= 1)
                            {
                                btnCollectionCall.Enabled = false;
                            }
                        }
                    }
                }

                //if(hdnHoldReason != null && myAbsence.HoldReason != null && myAbsence.HoldReason != "")
                //{
                //    hdnHoldReason.Text = myAbsence.HoldReason;
                //}
            }
        }