コード例 #1
0
ファイル: SupplierinfoForm.cs プロジェクト: xiciliu/MEMS
        protected override void FormLoad()
        {
            base.FormLoad();
            var client   = new CRMServiceClient();
            var stypelst = client.getSuptypeLst();

            foreach (var suptype in stypelst)
            {
                cmb_stype.Properties.Items.Add(suptype.typename);
            }
            if (this.formmode == frmmodetype.edit)
            {
                m_supplier = client.getSupplierbyId(m_supplierid);
                SetData();
            }
            else if (formmode == frmmodetype.delete)
            {
                m_supplier = client.getSupplierbyId(m_supplierid);
                SetData();
                readonlytxtbox(this.Controls, true);
            }
            var contactlst = client.getSupplierContacts(m_supplierid);

            this.gcContact.DataSource = contactlst;
        }
コード例 #2
0
        protected override void SearchObject()
        {
            var procode = txtprocode.Text;
            var proname = txtproname.Text;

            var customerlst = new List <int>();
            //foreach (CheckedListBoxItem item in checkedComboBoxEdit1.Properties.Items)
            //{
            //    if (item.CheckState==CheckState.Checked)
            //    {
            //        customerlst.Add((int)item.Value);
            //    }
            //}
            var checkitems = cmbcustomerlst.Properties.GetCheckedItems().ToString();
            var cidlst     = checkitems.Split(new char[] { ',' });

            foreach (var cid in cidlst)
            {
                customerlst.Add(Convert.ToInt32(cid));
            }
            CRMServiceClient   client = new CRMServiceClient();
            List <ProductList> plst   = client.getProductListbycdt(procode, proname, customerlst);

            gcproduct.DataSource = plst;
        }
コード例 #3
0
ファイル: SupplierinfoForm.cs プロジェクト: eseawind/MEMS
 protected override void AddObject()
 {
     T_Suppliers newsupplier = new T_Suppliers();
     newsupplier.accountname = txt_accountname.Text;
     newsupplier.accountno = txt_accountno.Text;
     newsupplier.address = txt_address.Text;
     newsupplier.bank = txt_bank.Text;
     newsupplier.city = txt_city.Text;
     newsupplier.country = txt_country.Text;
     newsupplier.email = txt_email.Text;
     newsupplier.fax = txt_fax.Text;
     newsupplier.legalperson = txt_legalman.Text;
     newsupplier.telphone = txt_phone.Text;
     newsupplier.postcode = txt_postcode.Text;
     newsupplier.province = txt_province.Text;
     newsupplier.remarks = txt_remarks.Text;
     newsupplier.businessscope = txt_scope.Text;
     newsupplier.simplename = txt_simplename.Text;
     newsupplier.suppliername = txt_splname.Text;
     newsupplier.supplierno = txt_splno.Text;
     newsupplier.taxcode = txt_taxno.Text;
     newsupplier.website = txt_website.Text;
     newsupplier.suppliertype = cmb_stype.SelectedText;
     var client = new CRMServiceClient();
     client.addNewSupplier(newsupplier);
     saveContact();
     base.AddObject();
 }
コード例 #4
0
ファイル: CustomerinfoForm.cs プロジェクト: xiciliu/MEMS
 private void btn_contactdel_Click(object sender, EventArgs e)
 {
     try
     {
         if (gvcontacts.DataRowCount > 0)
         {
             var ds        = (List <T_Customer_contacts>) this.gvcontacts.DataSource;
             int idx       = (int)gvcontacts.GetFocusedRowCellValue("id");
             var contactid = gvcontacts.FocusedRowHandle;
             if (idx <= 0)
             {
                 ds.RemoveAt(contactid);
                 gvcontacts.RefreshData();
             }
             else
             {
                 if (XtraMessageBox.Show("是否删除已保存的联系人", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
                 {
                     T_Customer_contacts contacts = ds.Find(c => c.id == idx);
                     var client = new CRMServiceClient();
                     client.DelCustomerContact(contacts);
                     ds.RemoveAt(contactid);
                     gvcontacts.RefreshData();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.Message);
     }
 }
コード例 #5
0
        public static CRMDataset GetAgents()
        {
            //Get a list of all agents
            CRMDataset       agents = null;
            CRMServiceClient client = null;

            try {
                ObjectCache cache = MemoryCache.Default;
                agents = cache["agents"] as CRMDataset;
                if (agents == null)
                {
                    agents = new CRMDataset();

                    client = new CRMServiceClient();
                    DataSet ds = client.GetAgents();
                    client.Close();
                    if (ds.Tables["AgentTable"] != null && ds.Tables["AgentTable"].Rows.Count > 0)
                    {
                        agents.Merge(ds);
                    }

                    DateTimeOffset policy = new DateTimeOffset(DateTime.Now.AddMinutes(1440));
                    cache.Set("agents", agents, policy);
                }
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <EnterpriseFault> cfe) { client.Abort(); throw new ApplicationException(cfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(agents);
        }
コード例 #6
0
ファイル: CustomersGateway.cs プロジェクト: jpheary/Argix10
        public Attachments GetAttachments(long issueID, long actionID)
        {
            //Get issue actions
            Attachments      attachments = null;
            CRMServiceClient client      = new CRMServiceClient();

            try {
                Issue issue = client.GetIssue(issueID);
                if (issue == null)
                {
                    issue = new Issue();
                }
                if (issue.Actions == null)
                {
                    issue.Actions = new Actions();
                }
                for (int i = 0; i < issue.Actions.Count; i++)
                {
                    if (issue.Actions[i].ID == actionID)
                    {
                        attachments = issue.Actions[i].Attachments;
                        break;
                    }
                }
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(attachments);
        }
コード例 #7
0
ファイル: CustomerinfoForm.cs プロジェクト: xiciliu/MEMS
 private void btn_addressdel_Click(object sender, EventArgs e)
 {
     try
     {
         if (gvaddress.DataRowCount > 0)
         {
             int idx       = (int)gvaddress.GetFocusedRowCellValue("id");
             var ds        = (List <T_Customer_address>)gvaddress.DataSource;
             var addressid = gvaddress.FocusedRowHandle;
             if (idx <= 0)
             {
                 ds.RemoveAt(addressid);
                 gvaddress.RefreshData();
             }
             else
             {
                 if (XtraMessageBox.Show("是否删除选中的收货地址", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                 {
                     var address = ds.Find(a => a.id == idx);
                     var client  = new CRMServiceClient();
                     client.DelCustomerAddress(address);
                     ds.RemoveAt(addressid);
                     gvaddress.RefreshData();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.Message);
     }
 }
コード例 #8
0
ファイル: CustomerinfoForm.cs プロジェクト: xiciliu/MEMS
        protected override void EditObject()
        {
            m_customer.customerno     = txt_cpno.Text;
            m_customer.customername   = txt_copname.Text;
            m_customer.simplename     = txt_copsname.Text;
            m_customer.country        = txt_country.Text;
            m_customer.website        = txt_website.Text;
            m_customer.companyaddress = txt_address.Text;
            m_customer.city           = txt_city.Text;
            m_customer.customerdesc   = txt_customerdesc.Text;
            m_customer.email          = txt_email.Text;
            m_customer.accountname    = txt_cw_accountname.Text;
            m_customer.accountno      = txt_cw_accountno.Text;
            m_customer.invoiceaddress = txt_cw_address.Text;
            m_customer.bank           = txt_cw_bank.Text;
            m_customer.taxcode        = txt_cw_taxcode.Text;
            m_customer.fax            = txt_fax.Text;
            m_customer.postcode       = txt_postcode.Text;
            m_customer.productinfo    = txt_productinfo.Text;
            m_customer.phone          = txt_phone.Text;
            m_customer.province       = txt_province.Text;
            m_customer.remarks        = txt_remark.Text;
            m_customer.customertype   = cmb_customertype.SelectedText;
            m_customer.companytype    = cmb_companytype.SelectedText;
            m_customer.profession     = cmb_profession.SelectedText;
            var client = new CRMServiceClient();

            client.EditCustomer(this.m_customer);
            saveAddress();
            saveContact();
            base.EditObject();
        }
コード例 #9
0
        public static CRMDataset GetIssueTypes(string issueCategory)
        {
            //Issue types- all or filtered by category
            CRMDataset       issueTypes = null;
            CRMServiceClient client     = null;

            try {
                ObjectCache cache = MemoryCache.Default;
                issueTypes = cache["issueTypes" + issueCategory] as CRMDataset;
                if (issueTypes == null)
                {
                    issueTypes = new CRMDataset();
                    client     = new CRMServiceClient();
                    DataSet ds = client.GetIssueTypes(issueCategory);
                    client.Close();
                    if (ds.Tables["IssueTypeTable"] != null && ds.Tables["IssueTypeTable"].Rows.Count > 0)
                    {
                        issueTypes.Merge(ds);
                    }

                    DateTimeOffset policy = new DateTimeOffset(DateTime.Now.AddMinutes(1440));
                    cache.Set("issueTypes" + issueCategory, issueTypes, policy);
                }
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException fe) { throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(issueTypes);
        }
コード例 #10
0
        public static EnterpriseDataset TrackCartonsForStoreByPickupDate(string clientID, string store, DateTime fromDate, DateTime toDate, string vendorID)
        {
            //
            EnterpriseDataset cartons = new EnterpriseDataset();
            CRMServiceClient  client  = new CRMServiceClient();

            try {
                DataSet ds = null;
                if (store.Trim().Length > 0)
                {
                    ds = client.TrackCartonsForStoreByPickupDate(clientID, store, fromDate, toDate, vendorID);
                }
                client.Close();

                if (ds != null && ds.Tables["CartonDetailForStoreTable"] != null && ds.Tables["CartonDetailForStoreTable"].Rows.Count > 0)
                {
                    cartons.Merge(ds, true, MissingSchemaAction.Ignore);
                }
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <TrackingFault> tfe) { client.Abort(); throw new ApplicationException(tfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(cartons);
        }
コード例 #11
0
        public static CRMDataset GetIssues()
        {
            //Get issues
            CRMDataset       issues = new CRMDataset();
            CRMServiceClient client = null;

            try {
                if (_Cache == null)
                {
                    _Cache = new IssueCache(DateTime.Today.AddDays(-App.Config.IssueDaysBack));
                }
                client = new CRMServiceClient();
                DataSet ds = client.GetIssuesForDate(_Cache.LastUpdated);
                client.Close();
                System.Diagnostics.Debug.WriteLine("PAYLOAD: fromDate=" + _Cache.LastUpdated.ToString("MM/dd/yyyy HH:mm:ss") + "; bytes=" + ds.GetXml().Length);

                CRMDataset _issues = new CRMDataset();
                if (ds.Tables["IssueTable"] != null && ds.Tables["IssueTable"].Rows.Count > 0)
                {
                    _issues.Merge(ds);
                    _Cache.UpdateCache(_issues);
                    issues.Merge(_Cache.Issues);
                }
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <CustomersFault> cfe) { client.Abort(); throw new ApplicationException(cfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(issues);
        }
コード例 #12
0
ファイル: ProductinfoForm.cs プロジェクト: wangrenjay/MEMS
        protected override void FormLoad()
        {
            CRMServiceClient client = new CRMServiceClient();
            var customerlst = client.getCustomerList();
            foreach (var customer in customerlst)
            {
                cmb_cst.Properties.Items.Add(customer.customername);
            }
            cmb_cst.Properties.Tag = customerlst;

            if (formmode == frmmodetype.edit)
            {
                m_product = client.getProductbyId(m_pid);
                setData();
                List<T_Crafts> craftlst = new List<T_Crafts>(client.getProductCraft(m_pid));
                gccraft.DataSource = craftlst;
            }
            else if (formmode == frmmodetype.delete)
            {
                m_product = client.getProductbyId(m_pid);
                setData();
                List<T_Crafts> craftlst = new List<T_Crafts>(client.getProductCraft(m_pid));
                gccraft.DataSource = craftlst;
            }
            
        }
コード例 #13
0
ファイル: EnterpriseGateway.cs プロジェクト: jpheary/Argix10
        public TrackingDataset TrackCartonsForStoreDetail(string clientID, string storeNumber, DateTime from, DateTime to, string tl, string by)
        {
            //Get carton details
            TrackingDataset  cartons = new TrackingDataset();
            CRMServiceClient client  = null;

            try {
                client = new CRMServiceClient();
                DataSet ds = null;
                if (by.ToLower() == "delivery")
                {
                    ds = client.TrackCartonsForStoreByDeliveryDate(clientID, storeNumber, from, to, null);
                }
                else
                {
                    ds = client.TrackCartonsForStoreByPickupDate(clientID, storeNumber, from, to, null);
                }
                client.Close();

                //Snag the carton detail
                TrackingDataset detail = new TrackingDataset();
                if (ds.Tables["CartonDetailForStoreTable"] != null && ds.Tables["CartonDetailForStoreTable"].Rows.Count > 0)
                {
                    detail.Merge(ds, true, MissingSchemaAction.Ignore);
                }

                //Get all cartons for the specified tl
                cartons.Merge(detail.CartonDetailForStoreTable.Select("TL='" + tl + "'"));
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <TrackingFault> tfe) { client.Abort(); throw new ApplicationException(tfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(cartons);
        }
コード例 #14
0
ファイル: CustomerinfoForm.cs プロジェクト: eseawind/MEMS
 protected override void AddObject()
 {
     T_Customer newcustomer = new T_Customer();
     newcustomer.customerno = txt_cpno.Text;
     newcustomer.customername = txt_copname.Text;
     newcustomer.simplename = txt_copsname.Text;
     newcustomer.country = txt_country.Text;
     newcustomer.website = txt_website.Text;
     newcustomer.companyaddress = txt_address.Text;
     newcustomer.city = txt_city.Text;
     newcustomer.customerdesc = txt_customerdesc.Text;
     newcustomer.email = txt_email.Text;
     newcustomer.accountname = txt_cw_accountname.Text;
     newcustomer.accountno = txt_cw_accountno.Text;
     newcustomer.invoiceaddress = txt_cw_address.Text;
     newcustomer.bank = txt_cw_bank.Text;
     newcustomer.taxcode = txt_cw_taxcode.Text;
     newcustomer.fax = txt_fax.Text;
     newcustomer.postcode = txt_postcode.Text;
     newcustomer.productinfo = txt_productinfo.Text;
     newcustomer.phone = txt_phone.Text;
     newcustomer.province = txt_province.Text;
     newcustomer.remarks = txt_remark.Text;
     newcustomer.customertype = cmb_customertype.SelectedText;
     newcustomer.companytype = cmb_companytype.SelectedText;
     newcustomer.profession = cmb_profession.SelectedText;
     var client = new CRMServiceClient();
     client.AddNewCustomer(newcustomer);
     saveAddress();
     saveContact();
     base.AddObject();
 }
コード例 #15
0
ファイル: CustomersGateway.cs プロジェクト: jpheary/Argix10
        public Actions GetIssueActions(long issueID)
        {
            //Get issue actions
            Issue            issue  = null;
            CRMServiceClient client = new CRMServiceClient();

            try {
                issue = client.GetIssue(issueID);
                if (issue == null)
                {
                    issue = new Issue();
                }
                if (issue.Actions == null)
                {
                    issue.Actions = new Actions();
                }
                for (int i = 0; i < issue.Actions.Count; i++)
                {
                    issue.Actions[i].Comment = issue.Actions[i].Comment.Replace("\n", "<br />");
                }
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(issue.Actions);
        }
コード例 #16
0
        public static CRMDataset GetCompanies()
        {
            //Companies; cache companies
            CRMDataset       companies = null;
            CRMServiceClient client    = null;

            try {
                ObjectCache cache = MemoryCache.Default;
                companies = cache["companies"] as CRMDataset;
                if (companies == null)
                {
                    companies = new CRMDataset();
                    client    = new CRMServiceClient();
                    DataSet ds = client.GetCompanies();
                    client.Close();
                    if (ds.Tables["CompanyTable"] != null && ds.Tables["CompanyTable"].Rows.Count > 0)
                    {
                        CRMDataset _ds = new CRMDataset();
                        _ds.CompanyTable.AddCompanyTableRow(0, "All", "000", "", 1);
                        _ds.Merge(ds.Tables["CompanyTable"].Select("IsActive = 1", "CompanyName ASC"));
                        companies.Merge(_ds);
                    }

                    DateTimeOffset policy = new DateTimeOffset(DateTime.Now.AddMinutes(1440));
                    cache.Set("companies", companies, policy);
                }
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <EnterpriseFault> cfe) { client.Abort(); throw new ApplicationException(cfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(companies);
        }
コード例 #17
0
ファイル: CustomersGateway.cs プロジェクト: jpheary/Argix10
        public TerminalDataset GetTerminals(string agentNumber)
        {
            //Returns a list of terminals
            TerminalDataset  terminals = new TerminalDataset();
            CRMServiceClient client    = new CRMServiceClient();

            try {
                TerminalDataset ts = new TerminalDataset();
                DataSet         ds = client.GetTerminals();
                client.Close();

                if (ds.Tables["TerminalTable"] != null && ds.Tables["TerminalTable"].Rows.Count > 0)
                {
                    ts.Merge(ds);
                }
                if (agentNumber == null)
                {
                    terminals.TerminalTable.AddTerminalTableRow(0, "", "All", "");
                    terminals.Merge(ts);
                }
                else
                {
                    terminals.Merge(ts.TerminalTable.Select("AgentID='" + agentNumber + "'"));
                }
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(terminals);
        }
コード例 #18
0
ファイル: SupplierinfoForm.cs プロジェクト: xiciliu/MEMS
        protected override void AddObject()
        {
            T_Suppliers newsupplier = new T_Suppliers();

            newsupplier.accountname   = txt_accountname.Text;
            newsupplier.accountno     = txt_accountno.Text;
            newsupplier.address       = txt_address.Text;
            newsupplier.bank          = txt_bank.Text;
            newsupplier.city          = txt_city.Text;
            newsupplier.country       = txt_country.Text;
            newsupplier.email         = txt_email.Text;
            newsupplier.fax           = txt_fax.Text;
            newsupplier.legalperson   = txt_legalman.Text;
            newsupplier.telphone      = txt_phone.Text;
            newsupplier.postcode      = txt_postcode.Text;
            newsupplier.province      = txt_province.Text;
            newsupplier.remarks       = txt_remarks.Text;
            newsupplier.businessscope = txt_scope.Text;
            newsupplier.simplename    = txt_simplename.Text;
            newsupplier.suppliername  = txt_splname.Text;
            newsupplier.supplierno    = txt_splno.Text;
            newsupplier.taxcode       = txt_taxno.Text;
            newsupplier.website       = txt_website.Text;
            newsupplier.suppliertype  = cmb_stype.SelectedText;
            var client = new CRMServiceClient();

            client.addNewSupplier(newsupplier);
            saveContact();
            base.AddObject();
        }
コード例 #19
0
ファイル: SupplierListForm.cs プロジェクト: wangrenjay/MEMS
 protected override void SearchObject()
 {
     var splyno = txtsplyno.Text;
     var splyname = txtsplyname.Text;
     CRMServiceClient client = new CRMServiceClient();
     var slist = client.getSupplierList(splyno, splyname);
     this.gcsupplier.DataSource = slist;
 }
コード例 #20
0
        //Interface
        static EnterpriseGateway()
        {
            //
            CRMServiceClient client = new CRMServiceClient();

            _state   = true;
            _address = client.Endpoint.Address.Uri.AbsoluteUri;
        }
コード例 #21
0
ファイル: ProductinfoForm.cs プロジェクト: wangrenjay/MEMS
 protected override void AddObject()
 {
     CRMServiceClient client = new CRMServiceClient();
     m_product = new T_Product();
     getData();
     client.AddNewProduct(m_product);
     base.AddObject();
 }
コード例 #22
0
ファイル: CustomerinfoForm.cs プロジェクト: xiciliu/MEMS
 protected override void DeleteObject()
 {
     if (XtraMessageBox.Show("是否删除该客户", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
     {
         var client = new CRMServiceClient();
         client.DeleteCustomer(m_customer);
     }
     base.DeleteObject();
 }
コード例 #23
0
        protected override void SearchObject()
        {
            var splyno              = txtsplyno.Text;
            var splyname            = txtsplyname.Text;
            CRMServiceClient client = new CRMServiceClient();
            var slist = client.getSupplierList(splyno, splyname);

            this.gcsupplier.DataSource = slist;
        }
コード例 #24
0
ファイル: CustomerListForm.cs プロジェクト: eseawind/MEMS
 protected override void SearchObject()
 {
     var companyno = txt_customerno.Text;
     var companyname = txt_customername.Text;
     var companysname = txt_sname.Text;
     CRMServiceClient client = new CRMServiceClient();
     List<T_Customer> clist = client.getCustomerListbyP(companyno,companyname,companysname);
     this.gccustomer.DataSource = clist;
 }
コード例 #25
0
ファイル: CustomerinfoForm.cs プロジェクト: wangrenjay/MEMS
 protected override void DeleteObject()
 {
     if (XtraMessageBox.Show("是否删除该客户", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
     {
         var client = new CRMServiceClient();
         client.DeleteCustomer(m_customer);
     }
     base.DeleteObject();
 }
コード例 #26
0
        protected override void SearchObject()
        {
            var companyno            = txt_customerno.Text;
            var companyname          = txt_customername.Text;
            var companysname         = txt_sname.Text;
            CRMServiceClient  client = new CRMServiceClient();
            List <T_Customer> clist  = client.getCustomerListbyP(companyno, companyname, companysname);

            this.gccustomer.DataSource = clist;
        }
コード例 #27
0
        public static CRMDataset GetRegions(string clientNumber)
        {
            //Get a list of regional locations for the specified client; convert schema field names to generic Location, LocationName
            CRMDataset       regions = null;
            CRMServiceClient client  = null;

            try {
                ObjectCache cache = MemoryCache.Default;
                regions = cache["regions" + clientNumber] as CRMDataset;
                if (regions == null)
                {
                    regions = new CRMDataset();
                    regions.LocationTable.AddLocationTableRow("All", "All");
                    if (clientNumber.Length > 3)
                    {
                        clientNumber = clientNumber.Substring(clientNumber.Length - 3, 3);
                    }
                    if (clientNumber == "000")
                    {
                        clientNumber = null;
                    }

                    client = new CRMServiceClient();
                    DataSet ds = client.GetRegionsDistricts(clientNumber);
                    client.Close();

                    //Filter out duplicate regions since resultset is district-region (child-parent)
                    System.Collections.Hashtable table = new System.Collections.Hashtable();
                    if (ds.Tables["LocationTable"] != null)
                    {
                        for (int i = 0; i < ds.Tables["LocationTable"].Rows.Count; i++)
                        {
                            string location     = ds.Tables["LocationTable"].Rows[i]["Region"].ToString().Trim();
                            string locationName = ds.Tables["LocationTable"].Rows[i]["RegionName"].ToString().Trim();
                            if (!table.ContainsKey(location))
                            {
                                table.Add(location, locationName);
                                regions.LocationTable.AddLocationTableRow(location, locationName);
                            }
                        }
                    }
                    regions.AcceptChanges();

                    DateTimeOffset policy = new DateTimeOffset(DateTime.Now.AddMinutes(1440));
                    cache.Set("regions" + clientNumber, regions, policy);
                }
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <EnterpriseFault> cfe) { client.Abort(); throw new ApplicationException(cfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(regions);
        }
コード例 #28
0
ファイル: CustomersGateway.cs プロジェクト: jpheary/Argix10
        public void WriteLogEntry(TraceMessage m)
        {
            //Write an entry into the Argix log
            CRMServiceClient client = new CRMServiceClient();

            try {
                client.WriteLogEntry(m);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <ConfigurationFault> cfe) { client.Abort(); throw new ApplicationException(cfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
        }
コード例 #29
0
        public static CRMDataset GetAgents(string clientNumber)
        {
            //Get a list of agents for the specified client
            CRMDataset       agents = null;
            CRMServiceClient client = null;

            try {
                ObjectCache cache = MemoryCache.Default;
                agents = cache["agents" + clientNumber] as CRMDataset;
                if (agents == null)
                {
                    agents = new CRMDataset();
                    agents.AgentTable.AddAgentTableRow("All", "", "All", "", "", "", "", "", 0, "", "", "", "", "", "", "", "", "", "All");
                    if (clientNumber.Length > 3)
                    {
                        clientNumber = clientNumber.Substring(clientNumber.Length - 3, 3);
                    }
                    if (clientNumber == "000")
                    {
                        clientNumber = null;
                    }

                    client = new CRMServiceClient();
                    DataSet ds = client.GetAgentsByClient(clientNumber);
                    client.Close();
                    if (ds.Tables["AgentTable"] != null && ds.Tables["AgentTable"].Rows.Count > 0)
                    {
                        CRMDataset _ds = new CRMDataset();
                        _ds.Merge(ds);
                        for (int i = 0; i < _ds.AgentTable.Rows.Count; i++)
                        {
                            _ds.AgentTable.Rows[i]["AgentSummary"] = (!_ds.AgentTable.Rows[i].IsNull("MainZone") ? _ds.AgentTable.Rows[i]["MainZone"].ToString().PadLeft(2, ' ') : "  ") + " - " +
                                                                     (!_ds.AgentTable.Rows[i].IsNull("AgentNumber") ? _ds.AgentTable.Rows[i]["AgentNumber"].ToString() : "    ") + " - " +
                                                                     (!_ds.AgentTable.Rows[i].IsNull("AgentName") ? _ds.AgentTable.Rows[i]["AgentName"].ToString().Trim() : "");
                        }
                        agents.Merge(_ds.AgentTable.Select("", "MainZone ASC"));
                        agents.AgentTable.AcceptChanges();
                    }

                    DateTimeOffset policy = new DateTimeOffset(DateTime.Now.AddMinutes(1440));
                    cache.Set("agents" + clientNumber, agents, policy);
                }
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <EnterpriseFault> cfe) { client.Abort(); throw new ApplicationException(cfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(agents);
        }
コード例 #30
0
        public static void WriteLogEntry(TraceMessage m)
        {
            //Get the operating enterprise terminal
            CRMServiceClient client = null;

            try {
                client = new CRMServiceClient();
                client.WriteLogEntry(m);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <ConfigurationFault> cfe) { client.Abort(); throw new ApplicationException(cfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
        }
コード例 #31
0
ファイル: CustomersGateway.cs プロジェクト: jpheary/Argix10
        public long CreateIssue(Issue issue)
        {
            //Create a new issue
            long             issueID = 0;
            CRMServiceClient client  = new CRMServiceClient();

            try {
                issueID = client.CreateIssue(issue);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(issueID);
        }
コード例 #32
0
ファイル: CustomersGateway.cs プロジェクト: jpheary/Argix10
        public Issue GetIssue(long issueID)
        {
            //Get issue
            Issue            issue  = null;
            CRMServiceClient client = new CRMServiceClient();

            try {
                issue = client.GetIssue(issueID);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(issue);
        }
コード例 #33
0
ファイル: CustomersGateway.cs プロジェクト: jpheary/Argix10
        public byte[] GetAttachment(int attachmentID)
        {
            //Get an attachment
            byte[]           attachment = null;
            CRMServiceClient client     = new CRMServiceClient();

            try {
                attachment = client.GetAttachment(attachmentID);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(attachment);
        }
コード例 #34
0
        public static TrackingItems TrackCartonsByLabelNumber(string[] itemNumbers)
        {
            //
            TrackingItems    items  = null;
            CRMServiceClient client = new CRMServiceClient();

            try {
                items = client.TrackCartonsByLabelNumber(itemNumbers, null, null);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(items);
        }
コード例 #35
0
ファイル: CustomersGateway.cs プロジェクト: jpheary/Argix10
        public bool AddAttachment(Attachment attachment)
        {
            //Add a new attachment to an existing action
            bool             added  = false;
            CRMServiceClient client = new CRMServiceClient();

            try {
                added = client.AddAttachment(attachment);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(added);
        }
コード例 #36
0
        //Interface
        static CRMGateway()
        {
            //
            CRMServiceClient client = new CRMServiceClient();

            _state   = true;
            _address = client.Endpoint.Address.Uri.AbsoluteUri;
            //_Cache = new IssueCache(DateTime.Today.AddDays(-App.Config.IssueDaysBack));

            RefreshTimer          = new System.Windows.Forms.Timer();
            RefreshTimer.Interval = 15000;
            RefreshTimer.Tick    += new EventHandler(OnTick);
            RefreshWorker         = new BackgroundWorker();
            RefreshWorker.DoWork += new DoWorkEventHandler(OnDoWork);
        }
コード例 #37
0
ファイル: CustomersGateway.cs プロジェクト: jpheary/Argix10
        public UserConfiguration GetUserConfiguration(string application, string[] usernames)
        {
            //Get the application configuration for the specified user
            UserConfiguration config = null;
            CRMServiceClient  client = new CRMServiceClient();

            try {
                config = client.GetUserConfiguration(application, usernames);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <ConfigurationFault> cfe) { client.Abort(); throw new ApplicationException(cfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(config);
        }
コード例 #38
0
ファイル: ProductListForm.cs プロジェクト: wangrenjay/MEMS
        protected override void FormLoad()
        {
            CRMServiceClient client = new CRMServiceClient();
            var customerlst = client.getCustomerList();
            //foreach (var customer in customerlst)
            //{
            //    cmbcustomer.Properties.Items.Add(customer.customername);
            //}
            cmbcustomerlst.Properties.DataSource = customerlst;
            cmbcustomerlst.Properties.DisplayMember = "customername";
            cmbcustomerlst.Properties.ValueMember = "id";
            cmbcustomerlst.Properties.SelectAllItemCaption = "选择全部";
            foreach (CheckedListBoxItem item in cmbcustomerlst.Properties.GetItems())
            {
                item.CheckState = CheckState.Checked;

            }
        }
コード例 #39
0
ファイル: ProductListForm.cs プロジェクト: eseawind/MEMS
        protected override void FormLoad()
        {
            base.FormLoad();
            CRMServiceClient client = new CRMServiceClient();
            var customerlst = client.getCustomerList();
            //foreach (var customer in customerlst)
            //{
            //    cmbcustomer.Properties.Items.Add(customer.customername);
            //}
            cmbcustomerlst.Properties.DataSource = customerlst;
            cmbcustomerlst.Properties.DisplayMember = "customername";
            cmbcustomerlst.Properties.ValueMember = "id";
            cmbcustomerlst.Properties.SelectAllItemCaption = "选择全部";
            foreach (CheckedListBoxItem item in cmbcustomerlst.Properties.GetItems())
            {
                item.CheckState = CheckState.Checked;

            }
            base.barbtn1.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
            base.barbtn1.LargeImageIndex = 17;
            barbtn1.Caption = "产品报价";
        }
コード例 #40
0
ファイル: CustomerinfoForm.cs プロジェクト: wangrenjay/MEMS
        protected override void FormLoad()
        {
            base.FormLoad();
            var client = new CRMServiceClient();
            if (this.formmode == frmmodetype.edit)
            {
                m_customer = client.getCustomerbyid(m_cid);
                SetData(m_customer);
            }
            else if (formmode == frmmodetype.delete)
            {
                m_customer = client.getCustomerbyid(m_cid);
                SetData(m_customer);
                enabletxtbox(this.Controls);
            }
            var comtypelst = client.getCpytypeList();
            foreach (var comtype in comtypelst)
            {
                this.cmb_companytype.Properties.Items.Add(comtype.typename);
            }
            var custypelst = client.getCtmtypeList();
            foreach (var custype in custypelst)
            {
                this.cmb_customertype.Properties.Items.Add(custype.typename);
            }
            var proflst = client.getProfList();
            foreach (var prof in proflst)
            {
                this.cmb_profession.Properties.Items.Add(prof.professionname);
            }
            List<T_Customer_address> addresslst = new List<T_Customer_address>(client.getCustomerAddressList(m_cid));
            this.gcaddress.DataSource = addresslst;
            List<T_Customer_contacts> contactlst = new List<T_Customer_contacts>(client.getCustomerContactList(m_cid));
            this.gccontacts.DataSource = contactlst;

            //this.btn_addressdel.Visible = false;
            //this.btn_contactdel.Visible = false;
        }
コード例 #41
0
ファイル: ProductListForm.cs プロジェクト: wangrenjay/MEMS
 protected override void SearchObject()
 {
     var procode = txtprocode.Text;
     var proname = txtproname.Text;
     var drawingno = txtdrawingno.Text;
     var customerlst = new List<int>();
     //foreach (CheckedListBoxItem item in checkedComboBoxEdit1.Properties.Items)
     //{
     //    if (item.CheckState==CheckState.Checked)
     //    {
     //        customerlst.Add((int)item.Value);
     //    }
     //}
     var checkitems = cmbcustomerlst.Properties.GetCheckedItems().ToString();
     var cidlst = checkitems.Split(new char[] { ',' });
     foreach (var cid in cidlst)
     {
         customerlst.Add(Convert.ToInt32(cid));
     }
     CRMServiceClient client = new CRMServiceClient();
     List<ProductList> plst = new List<ProductList>(client.getProductListbycdt(procode,proname,drawingno,customerlst.ToArray()));
     gcproduct.DataSource = plst;
 }
コード例 #42
0
ファイル: SupplierinfoForm.cs プロジェクト: wangrenjay/MEMS
 protected override void FormLoad()
 {
     base.FormLoad();
     var client = new CRMServiceClient();
     var stypelst = client.getSuptypeLst();
     foreach (var suptype in stypelst)
     {
         cmb_stype.Properties.Items.Add(suptype.typename);
     }
     if (this.formmode == frmmodetype.edit)
     {
         m_supplier = client.getSupplierbyId(m_supplierid);
         SetData();
     }
     else if (formmode == frmmodetype.delete)
     {
         m_supplier = client.getSupplierbyId(m_supplierid);
         SetData();
         enabletxtbox(this.Controls);
     }
     var contactlst = new List<T_Suppliers_contacts>(client.getSupplierContacts(m_supplierid));
     this.gcContact.DataSource = contactlst;
 }
コード例 #43
0
ファイル: ProductinfoForm.cs プロジェクト: wangrenjay/MEMS
 protected override void EditObject()
 {
     CRMServiceClient client = new CRMServiceClient();
     getData();
     client.UpdateProduct(m_product);
     base.EditObject();
 }
コード例 #44
0
 public void Dispose()
 {
     this.crmClient = null;
     instance = null;
 }
コード例 #45
0
ファイル: ProductinfoForm.cs プロジェクト: wangrenjay/MEMS
 private void btndel_Click(object sender, EventArgs e)
 {
     try
     {
         if (gvcraft.DataRowCount > 0)
         {
             var ds = (List<T_Crafts>)this.gvcraft.DataSource;
             int idx = (int)gvcraft.GetFocusedRowCellValue("id");
             var craftid = gvcraft.FocusedRowHandle;
             if (idx <= 0)
             {
                 ds.RemoveAt(craftid);
                 gvcraft.RefreshData();
             }
             else
             {
                 if (XtraMessageBox.Show("是否删除已保存的联系人", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
                 {
                     T_Crafts crafts = ds.Find(c => c.id == idx);
                     var client = new CRMServiceClient();
                     client.DeleteCraft(crafts);
                     ds.RemoveAt(craftid);
                     gvcraft.RefreshData();
                 }
             }
             gvcraft.FocusedRowHandle = ds.Count - 1;
         }
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.Message);
     }
 }
コード例 #46
0
ファイル: CustomerinfoForm.cs プロジェクト: eseawind/MEMS
 private void saveContact()
 {
     var client = new CRMServiceClient();
     foreach (var contact in modifycontactlst)
     {
         if (contact.id == 0)
         {
             client.AddCustomerContact(contact);
         }
         else
         {
             client.UpdCustomerContact(contact);
         }
     }
     gvcontacts.RefreshData();
 }
コード例 #47
0
ファイル: SupplierinfoForm.cs プロジェクト: eseawind/MEMS
 private void saveContact()
 {
     var client = new CRMServiceClient();
     foreach (var contact in modifycontactlst)
     {
         if (contact.id == 0)
         {
             client.AddSupplierContacts(contact);
         }
         else
         {
             client.EditSupplierContacts(contact);
         }
     }
     gvContact.RefreshData();
 }
コード例 #48
0
ファイル: CustomerinfoForm.cs プロジェクト: wangrenjay/MEMS
 private void btn_contactsave_Click(object sender, EventArgs e)
 {
     try
     {
         var client = new CRMServiceClient();
         foreach (var contact in modifycontactlst)
         {
             if (contact.id == 0)
             {
                 client.AddCustomerContact(contact);
             }
             else
             {
                 client.UpdCustomerContact(contact);
             }
         }
         gvcontacts.RefreshData();
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.Message);
     }
 }
コード例 #49
0
ファイル: CustomerinfoForm.cs プロジェクト: wangrenjay/MEMS
 private void btn_addressdel_Click(object sender, EventArgs e)
 {
     try
     {
         if (gvaddress.DataRowCount > 0)
         {
             int idx = (int)gvaddress.GetFocusedRowCellValue("id");
             var ds = (List<T_Customer_address>)gvaddress.DataSource;
             var addressid = gvaddress.FocusedRowHandle;
             if (idx <= 0)
             {
                 ds.RemoveAt(addressid);
                 gvaddress.RefreshData();
             }
             else
             {
                 if (XtraMessageBox.Show("是否删除选中的收货地址", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                 {
                     var address = ds.Find(a => a.id == idx);
                     var client = new CRMServiceClient();
                     client.DelCustomerAddress(address);
                     ds.RemoveAt(addressid);
                     gvaddress.RefreshData();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.Message);
     }
 }
コード例 #50
0
ファイル: CustomerinfoForm.cs プロジェクト: eseawind/MEMS
 private void saveAddress()
 {
     var webclient = new CRMServiceClient();
     foreach (var address in modifyaddresslst)
     {
         if (address.id == 0)
         {
             webclient.AddCustomerAddress(address);
         }
         else
         {
             webclient.UpdCustomerAddress(address);
         }
     }
     gvaddress.RefreshData();
 }
コード例 #51
0
ファイル: CustomerinfoForm.cs プロジェクト: wangrenjay/MEMS
 private void btn_addresssave_Click(object sender, EventArgs e)
 {
     try
     {
         var webclient = new CRMServiceClient();
         foreach (var address in modifyaddresslst)
         {
             if (address.id == 0)
             {
                 webclient.AddCustomerAddress(address);
             }
             else
             {
                 webclient.UpdCustomerAddress(address);
             }
         }
         gvaddress.RefreshData();
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.Message);
     }
 }