Ejemplo n.º 1
0
        private void mnuContextMenu_Click(object sender, RoutedEventArgs e)
        {
            MenuItem mnu  = (sender as MenuItem);
            string   name = mnu.Name;

            if (name.Equals("mnuEdit"))
            {
                showEditWindow();
            }
            else if (name.Equals("mnuCopy"))
            {
                CUtil.EnableForm(false, ParentControl);
                CTable newobj = OnixWebServiceAPI.CopyService(currentObj.GetDbObject());

                if (newobj != null)
                {
                    MService ivd = new MService(newobj);
                    itemSources.Insert(0, ivd);
                }
                else
                {
                    //Error here
                    CHelper.ShowErorMessage(OnixWebServiceAPI.GetLastErrorDescription(), "ERROR_USER_ADD", null);
                }

                CUtil.EnableForm(true, ParentControl);
            }
        }
Ejemplo n.º 2
0
        private void lkupItem_SelectedObjectChanged(object sender, EventArgs e)
        {
            UVoucherFreeProduct control = this;

            if (control.OnChanged != null)
            {
                control.OnChanged(control, null);
            }

            if (lkupItem != null)
            {
                lblUnit.Content = "";

                if (lkupItem.Lookup == LookupSearchType2.ServiceLookup)
                {
                    MService sv = (MService)lkupItem.SelectedObject;
                    if (sv != null)
                    {
                        lblUnit.Content = sv.ServiceUOMName;
                    }
                }
                else if (lkupItem.Lookup == LookupSearchType2.InventoryItemLookup)
                {
                    MInventoryItem sv = (MInventoryItem)lkupItem.SelectedObject;
                    if (sv != null)
                    {
                        lblUnit.Content = sv.ItemUOMName;
                    }
                }

                updateObject();
            }
        }
Ejemplo n.º 3
0
        public override Tuple <CTable, ObservableCollection <MBaseModel> > QueryData()
        {
            MService svc = (MService)model;

            if (!category.Equals("0") && !category.Equals(""))
            {
                svc.Category = category;
            }

            svc.ServiceLevel = level;

            items = OnixWebServiceAPI.GetServiceList(model.GetDbObject());
            lastObjectReturned = OnixWebServiceAPI.GetLastObjectReturned();

            itemSources.Clear();
            int idx = 0;

            foreach (CTable o in items)
            {
                MService v = new MService(o);

                v.RowIndex = idx;
                itemSources.Add(v);
                idx++;
            }

            Tuple <CTable, ObservableCollection <MBaseModel> > tuple = new Tuple <CTable, ObservableCollection <MBaseModel> >(lastObjectReturned, itemSources);

            return(tuple);
        }
Ejemplo n.º 4
0
        private static void GetQueryInfo()
        {
            var           conneMySql = ConfigurationManager.AppSettings["mysqlTest"].ToString();
            var           conneMS    = ConfigurationManager.AppSettings["msTest"].ToString();
            TestDBService service    = new TestDBService(conneMS);
            MService      mService   = new MService();

            //service.GetDBContext();
            mService.GetDBContext();
        }
Ejemplo n.º 5
0
        protected override MBaseModel createObject()
        {
            MService mv = new MService(new CTable(""));

            mv.CreateDefaultValue();
            mv.ServiceCategory = "1"; //Sale
            mv.ServiceLevel    = loadParam.GenericType;
            mv.Category        = "0";
            mv.IsSalary        = false;

            return(mv);
        }
        private void updateObject()
        {
            MPackagePrice v = (MPackagePrice)ProductSelected;

            if (v == null)
            {
                return;
            }

            v.ServiceObj      = null;
            v.ItemObj         = null;
            v.ItemCategoryObj = null;

            if (lkupItem.SelectedObject != null)
            {
                if (lkupItem.Lookup == LookupSearchType2.ServiceLookup)
                {
                    MService svc = (MService)lkupItem.SelectedObject;

                    v.ServiceObj    = svc;
                    v.SelectionType = "1";
                    v.Code          = svc.ServiceCode;
                    v.Name          = svc.ServiceName;
                }
                else if (lkupItem.Lookup == LookupSearchType2.InventoryItemLookup)
                {
                    MInventoryItem itm = (MInventoryItem)lkupItem.SelectedObject;

                    v.ItemObj       = itm;
                    v.SelectionType = "2";
                    v.Code          = itm.ItemCode;
                    v.Name          = itm.ItemNameThai;
                }
                else if (lkupItem.Lookup == LookupSearchType2.ItemCategoryLookup)
                {
                    MItemCategory cat = (MItemCategory)lkupItem.SelectedObject;

                    v.ItemCategoryObj = cat;
                    v.SelectionType   = "3";
                    v.Code            = cat.ItemCategoryID;
                    v.Name            = cat.CategoryName;
                }
                else if (lkupItem.Lookup == LookupSearchType2.ServiceTypeLookup)
                {
                    MMasterRef svt = (MMasterRef)lkupItem.SelectedObject;

                    v.ServiceTypeObj = svt;
                    v.SelectionType  = "4";
                    v.Code           = svt.Code;
                    v.Name           = svt.Description;
                }
            }
        }
Ejemplo n.º 7
0
        private void cmdInterval_Click(object sender, RoutedEventArgs e)
        {
            MService mv = (MService)vw;

            WinAddEditIntervalConfigEx w = new WinAddEditIntervalConfigEx(mv.PricingDefinition, mv.ServiceName, "IP");

            w.ShowDialog();
            if (w.IsOK)
            {
                mv.PricingDefinition = w.ConfigString;
                mv.IsModified        = true;
            }
        }
        private void addItemFromPayroll(ArrayList arr, int type)
        {
            String projectVariable = "PAYROLL_PROJECT_CODE";
            String serviceVariable = "PAYROLL_SERVICE_CODE";

            if (type == 2)
            {
                serviceVariable = "SOCIAL_SECURITY_SERVICE_CODE";
            }

            String   projectCode = CGlobalVariable.GetGlobalVariableValue(projectVariable);
            CTable   p           = getObject(projectCode, "PROJECT_CODE", "GetProjectList", "PROJECT_LIST");
            MProject pj          = new MProject(p);

            String   serviceCode = CGlobalVariable.GetGlobalVariableValue(serviceVariable);
            CTable   s           = getObject(serviceCode, "SERVICE_CODE", "GetServiceList", "SERVICE_LIST");
            MService sv          = new MService(s);

            foreach (MVPayrollDocument pd in arr)
            {
                CTable          t   = new CTable("");
                MAccountDocItem mdi = new MAccountDocItem(t);
                mdi.CreateDefaultValue();
                mdi.SelectType = "1";
                mdi.ServiceObj = sv;
                mdi.ProjectObj = pj;

                vw.AddAccountDocItem(mdi);

                MAuxilaryDocSubItem mi = new MAuxilaryDocSubItem(new CTable(""));
                mi.Description = String.Format("{0}-{1} {2}", pd.FromSalaryDateFmt, pd.ToSalaryDateFmt, pd.EmployeeTypeDesc);
                mi.SubItemDate = pd.ToSalaryDate;
                mi.UnitPrice   = pd.ReceiveAmount;

                if (type == 2)
                {
                    mi.UnitPrice = pd.SocialSecurityCompanyAmount;
                }

                mi.Quantity = "1.00";
                mdi.AddItemDetail(mi);

                mdi.CalculateSubItemTotal();
                mdi.SerializeItemDetails();
            }
        }
Ejemplo n.º 9
0
    public void Get_Users_ReturnsUserList()
    {
        //Arrange
        var expected = new List <FUser>()
        {
            //populate with some users
        };
        var mockRepository = new  Mock <IMRepository>();

        mockRepository.Setup(_ => _.ExecuteCommandReader()).Returns(expected);

        var mService = new MService(mockRepository.Object);

        //Act
        var resultList = mService.GetFUser();

        //Assert
        Assert.IsTrue(resultList.Count > 0);
    }