Exemplo n.º 1
0
 /// <summary>
 /// Create a new tmdlcontact object.
 /// </summary>
 /// <param name="customerid">Initial value of the customerid property.</param>
 /// <param name="contactname">Initial value of the contactname property.</param>
 public static tmdlcontact Createtmdlcontact(global::System.String customerid, global::System.String contactname)
 {
     tmdlcontact tmdlcontact = new tmdlcontact();
     tmdlcontact.customerid = customerid;
     tmdlcontact.contactname = contactname;
     return tmdlcontact;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the tmdlcontact EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotmdlcontact(tmdlcontact tmdlcontact)
 {
     base.AddObject("tmdlcontact", tmdlcontact);
 }
Exemplo n.º 3
0
        private void DoSave()
        {
            try
            {
                baseForm.SetCursor();
                baseForm.ValidateData(this);

                tmdlcustomer customer = new tmdlcustomer();
                if (UpdateMode == Public_UpdateMode.Update)
                {
                    customer = baseForm.OriginalObject as tmdlcustomer;
                }
                baseForm.CreateSingleObject<tmdlcustomer>(customer, this, UpdateMode);

                List<tmdlcontact> lstContact = new List<tmdlcontact>();

                for (int i = 0; i < this.grdContact.Rows.Count; i++)
                {
                    tmdlcontact contact = new tmdlcontact();
                    contact.contactname = this.grdContact.Rows[i].Cells["contactname"].Value.ToString();
                    contact.customerid = this.grdContact.Rows[i].Cells["customerid"].Value.ToString();
                    contact.email = this.grdContact.Rows[i].Cells["email"].Value.ToString();
                    contact.faxno = this.grdContact.Rows[i].Cells["faxno"].Value.ToString();
                    contact.isdefault = this.grdContact.Rows[i].Cells["isdefault"].Value.ToString();
                    contact.mobileno = this.grdContact.Rows[i].Cells["mobileno"].Value.ToString();
                    contact.remark = this.grdContact.Rows[i].Cells["remark"].Value.ToString();
                    contact.telphone = this.grdContact.Rows[i].Cells["telphone"].Value.ToString();
                    contact.title = this.grdContact.Rows[i].Cells["title"].Value.ToString();
                    contact.sex = this.grdContact.Rows[i].Cells["sex"].Value.ToString();

                    baseForm.PrepareObject<tmdlcontact>(contact, Public_UpdateMode.Insert);

                    lstContact.Add(contact);
                }

                if (UpdateMode == Public_UpdateMode.Insert)
                {
                    InsertCustomer(customer, lstContact);
                }
                else
                {
                    UpdateCustomer(customer, lstContact);
                }

                if (UpdateMode == Public_UpdateMode.Insert)
                    baseForm.CreateMessageBox(Public_MessageBox.Information, MessageBoxButtons.OK, null, UtilCulture.GetString("Msg.R00001"));
                else if (UpdateMode == Public_UpdateMode.Update)
                    baseForm.CreateMessageBox(Public_MessageBox.Information, MessageBoxButtons.OK, null, UtilCulture.GetString("Msg.R00002"));

                this.Dispose();
            }
            catch (Exception ex)
            {
                MESMsgBox.ShowError(ExceptionParser.Parse(ex));
            }
            finally
            {
                baseForm.ResetCursor();
            }
        }