Beispiel #1
0
        // PUT api/CRMCusBilling?tblBilling
        public void Put(string CusId, [FromBody] tblCusBilling cb)
        {
            using (var ctx = new CRMModel())
            {
                // Update Statement
                var update = ctx.tblCusBillings.Where(ci => ci.CusId == CusId).FirstOrDefault();
                if (update != null)
                {
                    update.CusId      = cb.CusId;
                    update.CustomerId = cb.CustomerId;
                    update.CusCode    = cb.CusCode;
                    update.Name       = cb.Name;
                    update.ADDR1      = cb.ADDR1;
                    update.ADDR2      = cb.ADDR2;
                    update.ADDR3      = cb.ADDR3;
                    update.TEL        = cb.TEL;
                    update.ACCOUNT    = cb.ACCOUNT;
                    update.LAST       = cb.LAST;
                    update.EmailTo    = cb.EmailTo;
                    update.OUTSTND    = cb.OUTSTND;
                    update.MTD        = cb.MTD;
                    update.YTD        = cb.YTD;
                    update.TERM       = cb.TERM;
                    update.ACCT       = cb.ACCT;
                    update.ATTN       = cb.ATTN;
                    update.INVOICING  = cb.INVOICING;
                    update.WHTax      = cb.WHTax;
                    update.EmId       = cb.EmId;
                    update.AddPerson  = cb.AddPerson;
                    update.Department = cb.Department;
                }

                ctx.SaveChanges();
            }
        }
Beispiel #2
0
        // PUT api/CRMCustomer?tblCustomer
        public void Put(string CusId, [FromBody] tblCustomer c)
        {
            using (var ctx = new CRMModel())
            {
                // Update Statement
                var update = ctx.tblCustomers.Where(ci => ci.CusId == CusId).FirstOrDefault();
                if (update != null)
                {
                    update.CusId        = c.CusId;
                    update.CustomerType = c.CustomerType;
                    update.CusUTitle    = c.CusUTitle;
                    update.CusUFName    = c.CusUFName;
                    update.CusULName    = c.CusULName;
                    update.CusUAddress  = c.CusUAddress;
                    update.CusUPhone    = c.CusUPhone;
                    update.CusUPhoneM   = c.CusUPhoneM;
                    update.CusUFax      = c.CusUFax;
                    update.CusUEmail    = c.CusUEmail;
                    update.CusNote      = c.CusNote;
                    update.EmId         = c.EmId;
                    update.AddPerson    = c.AddPerson;
                    update.Department   = c.Department;
                    update.SaleName     = c.SaleName;
                    update.Careof       = c.Careof;
                    update.CareofName   = c.CareofName;
                    update.ServiceType  = c.ServiceType;
                    update.EmailState   = c.EmailState;
                    update.Status       = c.Status;
                    update.CustomerDate = c.CustomerDate;
                    update.CustomerTime = c.CustomerTime;
                }

                ctx.SaveChanges();
            }
        }
Beispiel #3
0
        // POST api/CRMCusBilling?tblCusBilling
        public void Post([FromBody] tblCusBilling cb)
        {
            using (var ctx = new CRMModel())
            {
                var cusbill = ctx.Set <tblCusBilling>();
                cusbill.Add(new tblCusBilling
                {
                    CusId      = cb.CusId,
                    CustomerId = cb.CustomerId,
                    CusCode    = cb.CusCode,
                    Name       = cb.Name,
                    ADDR1      = cb.ADDR1,
                    ADDR2      = cb.ADDR2,
                    ADDR3      = cb.ADDR3,
                    TEL        = cb.TEL,
                    ACCOUNT    = cb.ACCOUNT,
                    LAST       = cb.LAST,
                    EmailTo    = cb.EmailTo,
                    OUTSTND    = cb.OUTSTND,
                    MTD        = cb.MTD,
                    YTD        = cb.YTD,
                    TERM       = cb.TERM,
                    ACCT       = cb.ACCT,
                    ATTN       = cb.ATTN,
                    INVOICING  = cb.INVOICING,
                    WHTax      = cb.WHTax,
                    EmId       = cb.EmId,
                    AddPerson  = cb.AddPerson,
                    Department = cb.Department
                });

                ctx.SaveChanges();
            }
        }
Beispiel #4
0
        // POST api/CRMCustomer?tblCustomer
        public void Post([FromBody] tblCustomer c)
        {
            using (var ctx = new CRMModel())
            {
                var customer = ctx.Set <tblCustomer>();
                customer.Add(new tblCustomer
                {
                    CusId        = c.CusId,
                    CustomerType = c.CustomerType,
                    CusUTitle    = c.CusUTitle,
                    CusUFName    = c.CusUFName,
                    CusULName    = c.CusULName,
                    CusUAddress  = c.CusUAddress,
                    CusUPhone    = c.CusUPhone,
                    CusUPhoneM   = c.CusUPhoneM,
                    CusUFax      = c.CusUFax,
                    CusUEmail    = c.CusUEmail,
                    CusNote      = c.CusNote,
                    EmId         = c.EmId,
                    AddPerson    = c.AddPerson,
                    Department   = c.Department,
                    SaleName     = c.SaleName,
                    Careof       = c.Careof,
                    CareofName   = c.CareofName,
                    ServiceType  = c.ServiceType,
                    EmailState   = c.EmailState,
                    Status       = c.Status,
                    CustomerDate = c.CustomerDate,
                    CustomerTime = c.CustomerTime
                });

                ctx.SaveChanges();
            }
        }
Beispiel #5
0
        // POST api/CRMOriginDestination?tblOriginDestination
        public void Post([FromBody] tblOriginDestination od)
        {
            using (var ctx = new CRMModel())
            {
                var cuscon = ctx.Set <tblOriginDestination>();
                cuscon.Add(new tblOriginDestination
                {
                    CusId       = od.CusId,
                    No          = od.No,
                    Origin      = od.Origin,
                    Destination = od.Destination,
                    EmId        = od.EmId,
                    AddPerson   = od.AddPerson,
                    Department  = od.Department
                });

                ctx.SaveChanges();
            }
        }
Beispiel #6
0
        // PUT api/CRMOriginDestination?CusId,No,tblOrigindestination
        public void Put(String CusId, int No, [FromBody] tblOriginDestination od)
        {
            using (var ctx = new CRMModel())
            {
                // Update Statement
                var update = ctx.tblOriginDestinations.Where(ci => ci.CusId == CusId).FirstOrDefault();
                if (update != null)
                {
                    update.CusId       = od.CusId;
                    update.No          = od.No;
                    update.Origin      = od.Origin;
                    update.Destination = od.Destination;
                    update.EmId        = od.EmId;
                    update.AddPerson   = od.AddPerson;
                    update.Department  = od.Department;
                }

                ctx.SaveChanges();
            }
        }
Beispiel #7
0
        // POST api/CRMPs?tblPS
        public void Post([FromBody] tblP PS)
        {
            using (var ctx = new CRMModel())
            {
                var cuscon = ctx.Set <tblP>();
                cuscon.Add(new tblP
                {
                    CusID     = PS.CusID,
                    PSRefNo   = PS.PSRefNo,
                    PSubID    = PS.PSubID,
                    Plot      = PS.Plot,
                    Isudt     = PS.Isudt,
                    MoveDate  = PS.MoveDate,
                    PSId      = PS.PSId,
                    ProjectID = PS.ProjectID,
                    ExPDate   = PS.ExPDate
                });

                ctx.SaveChanges();
            }
        }
Beispiel #8
0
        // PUT api/CRMPs?CusId,tblPS
        public void Put(String CusId, [FromBody] tblP PS)
        {
            using (var ctx = new CRMModel())
            {
                // Update Statement
                var update = ctx.tblPS.Where(ci => ci.CusID == CusId).FirstOrDefault();
                if (update != null)
                {
                    update.CusID     = PS.CusID;
                    update.PSRefNo   = PS.PSRefNo;
                    update.PSubID    = PS.PSubID;
                    update.Plot      = PS.Plot;
                    update.Isudt     = PS.Isudt;
                    update.MoveDate  = PS.MoveDate;
                    update.PSId      = PS.PSId;
                    update.ProjectID = PS.ProjectID;
                    update.ExPDate   = PS.ExPDate;
                }

                ctx.SaveChanges();
            }
        }
Beispiel #9
0
        // POST api/CRMCusContact?tblCuscontact
        public void Post([FromBody] tblCusContact cc)
        {
            using (var ctx = new CRMModel())
            {
                var cuscon = ctx.Set <tblCusContact>();
                cuscon.Add(new tblCusContact
                {
                    CusId         = cc.CusId,
                    ContactId     = cc.ContactId,
                    ContactName   = cc.ContactName,
                    ContactPhoneH = cc.ContactPhoneH,
                    ContactPhoneO = cc.ContactPhoneO,
                    ContactPhoneM = cc.ContactPhoneM,
                    ContactFax    = cc.ContactFax,
                    ContactEmail  = cc.ContactEmail,
                    EmId          = cc.EmId,
                    AddPerson     = cc.AddPerson,
                    Department    = cc.Department
                });

                ctx.SaveChanges();
            }
        }
Beispiel #10
0
        // PUT api/CRMCusContact?CusId,ContactId,tblCuscontact
        public void Put(string CusId, string ContactId, [FromBody] tblCusContact cc)
        {
            using (var ctx = new CRMModel())
            {
                // Update Statement
                var update = ctx.tblCusContacts.Where(ci => ci.CusId == CusId).FirstOrDefault();
                if (update != null)
                {
                    update.CusId         = cc.CusId;
                    update.ContactId     = cc.ContactId;
                    update.ContactName   = cc.ContactName;
                    update.ContactPhoneH = cc.ContactPhoneH;
                    update.ContactPhoneO = cc.ContactPhoneO;
                    update.ContactPhoneM = cc.ContactPhoneM;
                    update.ContactFax    = cc.ContactFax;
                    update.ContactEmail  = cc.ContactEmail;
                    update.EmId          = cc.EmId;
                    update.AddPerson     = cc.AddPerson;
                    update.Department    = cc.Department;
                }

                ctx.SaveChanges();
            }
        }