示例#1
0
        public void BindTypeOfCar()
        {
            #region Type of Car
            IList <SS.DB.DTO.ValueObject.TranslatedListItem> translateList2 = new List <SS.DB.DTO.ValueObject.TranslatedListItem>();

            SS.DB.DTO.ValueObject.TranslatedListItem TypeOfCar1 = new SS.DB.DTO.ValueObject.TranslatedListItem();
            TypeOfCar1.ID     = UIHelper.ParseShort("1");
            TypeOfCar1.Symbol = "Passenger Car";
            translateList2.Add(TypeOfCar1);


            SS.DB.DTO.ValueObject.TranslatedListItem TypeOfCar3 = new SS.DB.DTO.ValueObject.TranslatedListItem();
            TypeOfCar3.ID     = UIHelper.ParseShort("2");
            TypeOfCar3.Symbol = "Pick-up";
            translateList2.Add(TypeOfCar3);


            if (ctlDropDownListCategory.SelectedValue.Equals("2"))
            {
                SS.DB.DTO.ValueObject.TranslatedListItem TypeOfCar2 = new SS.DB.DTO.ValueObject.TranslatedListItem();
                TypeOfCar2.ID     = UIHelper.ParseShort("3");
                TypeOfCar2.Symbol = "Motorcycle";
                translateList2.Add(TypeOfCar2);
            }


            ctlDropDownListType.DataSource     = translateList2;
            ctlDropDownListType.DataTextField  = "Symbol";
            ctlDropDownListType.DataValueField = "Id";
            ctlDropDownListType.DataBind();
            ctlDropDownListType.SelectedIndex = 0;
            #endregion
        }
示例#2
0
        public void BindControl(bool isCopy)
        {
            if (!isCopy && this.InitialFlag.Equals(FlagEnum.NewFlag))
            {
                ctlCompanyField.ShowDefault();
                ctlCreatorData.ShowDefault();
                ctlRequesterData.ShowDefault();
                ctlRegular.Checked = true;
                if (ctlSomeTime.Checked == true)
                {
                    tableRegular.Visible = false;
                }
                if (ctlRegular.Checked == true)
                {
                    sometimeRegular.Visible = false;
                }
                ctlWorkOutOfAreatxt.Enabled = false;

                ctlInitiator.RequesterID = UIHelper.ParseLong(ctlRequesterData.UserID);
                ctlApproverData.ShowDefaultApprover(UIHelper.ParseLong(ctlRequesterData.UserID));
            }
            else
            {
                Guid txID         = this.TransactionID;
                long caDocumentID = this.CADocumentID;
                CADocumentDataSet caDocumentDS = (CADocumentDataSet)TransactionService.GetDS(txID);
                CADocumentDataSet.CADocumentRow caDocumentRow = caDocumentDS.CADocument.FindByCADocumentID(this.CADocumentID);
                CADocumentDataSet.DocumentRow   documentRow   = caDocumentDS.Document.FindByDocumentID(caDocumentRow.DocumentID);

                SS.Standard.WorkFlow.DTO.WorkFlow workFlow = WorkFlowQueryProvider.WorkFlowQuery.GetWorkFlowByDocumentID(caDocumentRow.DocumentID);

                #region Header & Footer
                if (!isCopy)
                {
                    ctlCAFormHeader.No     = ScgeAccountingQueryProvider.SCGDocumentQuery.GetSCGDocumentByDocumentID(caDocumentRow.DocumentID).DocumentNo;
                    ctlCAFormHeader.Status = ScgeAccountingQueryProvider.SCGDocumentQuery.GetDocumentCurrentStateName(UserAccount.CurrentLanguageID, caDocumentRow.DocumentID);
                    if (documentRow.DocumentDate != DateTime.MinValue)
                    {
                        ctlCAFormHeader.CreateDate = UIHelper.ToDateString(documentRow.DocumentDate);
                    }
                    ctlCreatorData.SetValue(documentRow.CreatorID);
                }
                else
                {
                    ctlCAFormHeader.Status = FlagEnum.NewFlag;
                    ctlCreatorData.ShowDefault();
                }

                ctlCompanyField.SetValue(documentRow.CompanyID);
                ctlSubject.Text = documentRow.Subject;
                ctlRequesterData.SetValue(documentRow.RequesterID);
                ctlApproverData.SetValue(documentRow.ApproverID);

                #endregion Header & Footer

                #region Tab Attachment
                ctlAttachment.BindControl();
                #endregion

                #region Tab Memo
                ctlMemo.Text = documentRow.Memo;
                #endregion Tab Memo

                #region Tab General
                if (!caDocumentRow.IsCarLicenseNoNull())
                {
                    ctlCarLicenseNo.Text = caDocumentRow.CarLicenseNo;
                }

                if (!caDocumentRow.IsBrandNull())
                {
                    ctlBrand.Text = caDocumentRow.Brand;
                }

                if (!caDocumentRow.IsModelNull())
                {
                    ctlModel.Text = caDocumentRow.Model;
                }
                if (caDocumentRow.IsTemporary)
                {
                    ctlSomeTime.Checked       = true;
                    ctlStartDateSumtime.Value = caDocumentRow.StartDate;
                    ctlEndDateSumtime.Value   = caDocumentRow.EndDate;
                    if (ctlSomeTime.Checked == true)
                    {
                        tableRegular.Visible = false;
                    }
                }
                else
                {
                    ctlRegular.Checked = true;
                    ctlStartDate.Value = caDocumentRow.StartDate;
                    ctlEndDate.Value   = caDocumentRow.EndDate;
                    if (ctlRegular.Checked == true)
                    {
                        sometimeRegular.Visible = false;
                    }
                }


                if (!caDocumentRow.IsIsWorkAreaNull())
                {
                    if (!caDocumentRow.IsIsWorkAreaNull() && caDocumentRow.IsWorkArea)
                    {
                        ctlWorkInArea.Checked = true;
                    }
                    else
                    {
                        ctlWorkOutOfArea.Checked = true;
                        if (!caDocumentRow.IsRemarkNull())
                        {
                            ctlWorkOutOfAreatxt.Text = caDocumentRow.Remark;
                        }
                    }
                }
                switch (caDocumentRow.CarType)
                {
                case "COM":
                    ctlDropDownListCategory.SelectedIndex = UIHelper.ParseShort("1");
                    break;

                case "EMP":
                    ctlDropDownListCategory.SelectedIndex = UIHelper.ParseShort("2");
                    break;

                default:
                    break;
                }
                switch (caDocumentRow.OwnerType)
                {
                case "PRI":
                    ctlDropDownListType.SelectedIndex = UIHelper.ParseShort("1");
                    break;

                case "PIC":
                    ctlDropDownListType.SelectedIndex = UIHelper.ParseShort("2");
                    break;

                case "MOT":
                    ctlDropDownListType.SelectedIndex = UIHelper.ParseShort("3");
                    break;

                default:
                    break;
                }

                #endregion Tab General
            }

            #region Owner
            IList <SS.DB.DTO.ValueObject.TranslatedListItem> translateList1 = new List <SS.DB.DTO.ValueObject.TranslatedListItem>();

            SS.DB.DTO.ValueObject.TranslatedListItem Owner1 = new SS.DB.DTO.ValueObject.TranslatedListItem();
            Owner1.ID     = UIHelper.ParseShort("1");
            Owner1.Symbol = "Company";
            translateList1.Add(Owner1);

            SS.DB.DTO.ValueObject.TranslatedListItem Owner2 = new SS.DB.DTO.ValueObject.TranslatedListItem();
            Owner2.ID     = UIHelper.ParseShort("2");
            Owner2.Symbol = "Employee";
            translateList1.Add(Owner2);

            ctlDropDownListCategory.DataSource     = translateList1;
            ctlDropDownListCategory.DataTextField  = "Symbol";
            ctlDropDownListCategory.DataValueField = "Id";
            ctlDropDownListCategory.DataBind();
            ctlDropDownListCategory.SelectedIndex = 0;
            #endregion
            BindTypeOfCar();
            this.UpdatePanel();
        }