Esempio n. 1
0
        // GetInfo
        #region GetInfo
        /// <summary>
        /// خواندن اطلاعات شرکت های اقماری از بانک اطلاعاتی و قرار دادن در متغیر
        /// </summary>
        private void _getItems()
        {
            JDataBase DB = JGlobal.MainFrame.GetDBO();

            try
            {
                DB.setQuery(_SQL);
                DB.Query_DataSet();
                _Items = new JASubsidiaries[DB.DataSet.Tables[0].Rows.Count];
                int count = 0;
                foreach (DataRow DR in DB.DataSet.Tables[0].Rows)
                {
                    Items[count] = new JASubsidiaries();
                    Items[count].GetData(int.Parse(DR["code"].ToString()));
                    count++;
                }
            }
            catch (Exception ex)
            {
                JSystem.Except.AddException(ex);
            }
            finally
            {
                DB.Dispose();
            }
        }
Esempio n. 2
0
        private bool _Validation()
        {
            //----------------- اعتبار سنجی نام --------
            if (txtNameCompany.Text.Trim() == "")
            {
                JMessages.Message(JLanguages._Text("Server Information Is Incorrect!"), JLanguages._Text("Error"), JMessageType.Error);
                txtNameCompany.Focus();
                return(false);
            }

            JASubsidiaries JS = new  JASubsidiaries();

            JS.Name = txtNameCompany.Text.Trim();
            if ((State == JFormState.Insert && JS.Find()) ||
                (State == JFormState.Update && txtNameCompany.Text.Trim() != _jClass.Name && JS.Find()))
            {
                JMessages.Message(JLanguages._Text("This Name is Exist in Database"), JLanguages._Text("Error"), JMessageType.Error);
                txtNameCompany.Focus();
                return(false);
            }
            //-------------------------------------------------
            //         اعتبار سنجی اطلاعات سرور
            System.Data.SqlClient.SqlConnection TestCnn = new System.Data.SqlClient.SqlConnection(
                "Password="******";User ID=" + txtServer_User.Text.Trim() +
                ";Initial Catalog=" + txtDataBaseName.Text.Trim() +
                ";Data Source=" + txtServer_name.Text.Trim());
            try
            {
                TestCnn.Open();
            }
            catch
            {
                JMessages.Message(JLanguages._Text("Server Information Is Incorrect!"), JLanguages._Text("Error"), JMessageType.Error);
                txtServer_name.Focus();
                return(false);
            }
            TestCnn.Close();
            TestCnn.Dispose();
            //--------------- اعتبار سنجی کد دسترسی سریع-----------------
            if (nedAccessCode.Text.Trim() != "")
            {
                JS             = new JASubsidiaries();
                JS.access_code = Convert.ToInt32(nedAccessCode.Text);
                if ((State == JFormState.Insert && JS.Find()) ||
                    (State == JFormState.Update && nedAccessCode.Text.Trim() != _jClass.access_code.ToString() && JS.Find()))
                {
                    JMessages.Message(JLanguages._Text("Access Code IS Reserved!"), JLanguages._Text("Error"), JMessageType.Error);
                    nedAccessCode.Focus();
                    return(false);
                }
            }


            return(true);
        }
Esempio n. 3
0
        public JfrmSubsidiaries(JASubsidiaries jClass)
        {
            InitializeComponent();

            btnAction.Text = JLanguages._Text("Insert");

            if (jClass != null)
            {
                _jClass        = jClass;
                btnAction.Text = JLanguages._Text("Update");
            }
        }
Esempio n. 4
0
 private void btnAction_Click(object sender, EventArgs e)
 {
     try
     {
         if (_Validation())
         {
             if (State == JFormState.Insert)
             {
                 JASubsidiaries tmpJSubsidiaries = new JASubsidiaries();
                 //tmpJSubsidiaries.Nodes = _jClass.Nodes;
                 tmpJSubsidiaries.Name = txtNameCompany.Text.Trim();
                 tmpJSubsidiaries.managing_director = txtmanaging_Director.Text.Trim();
                 tmpJSubsidiaries.phone_number      = txtPhone.Text;
                 tmpJSubsidiaries.address           = txtAddress.Text;
                 tmpJSubsidiaries.server_name       = txtServer_name.Text.Trim();
                 tmpJSubsidiaries.server_user       = txtServer_User.Text.Trim();
                 tmpJSubsidiaries.server_pass       = txtServer_Pass.Text;
                 tmpJSubsidiaries.database_name     = txtDataBaseName.Text.Trim();
                 if (nedAccessCode.Text != "")
                 {
                     tmpJSubsidiaries.access_code = Convert.ToInt32(nedAccessCode.Text);
                 }
                 tmpJSubsidiaries.description = txtDescription.Text;
                 tmpJSubsidiaries.Insert();
                 Close();
             }
             else if (State == JFormState.Update)
             {
                 _jClass.Name = txtNameCompany.Text.Trim();
                 _jClass.managing_director = txtmanaging_Director.Text.Trim();
                 _jClass.phone_number      = txtPhone.Text;
                 _jClass.address           = txtAddress.Text;
                 _jClass.server_name       = txtServer_name.Text.Trim();
                 _jClass.server_user       = txtServer_User.Text.Trim();
                 _jClass.server_pass       = txtServer_Pass.Text;
                 _jClass.database_name     = txtDataBaseName.Text.Trim();
                 if (nedAccessCode.Text != "")
                 {
                     _jClass.access_code = Convert.ToInt32(nedAccessCode.Text);
                 }
                 _jClass.description = txtDescription.Text;
                 _jClass.Update();
                 DialogResult = DialogResult.OK;
                 this.Close();
             }
         }
     }
     catch (Exception ex)
     {
         JSystem.Except.AddException(ex);
     }
 }
Esempio n. 5
0
        public static JNode _SubsidiariesNode(JASubsidiaries pSubsidiaries)
        {
            JNode Node = new JNode(pSubsidiaries.Code, "Automation.JASubsidiaries");

            Node.Name = pSubsidiaries.Name;

            JAction EditAction = new JAction("Edit...", "Automation.JASubsidiaries.UpdateForm", new object[] { pSubsidiaries.Code }, null);

            Node.MouseDBClickAction = EditAction;
            Node.MouseClickAction   = EditAction;
            //Node.Icone = 5;
            Node.Popup.Insert(EditAction);

            JAction DeleteAction = new JAction("Delete", "Automation.JASubsidiaries.Delete", new object[] { pSubsidiaries.Code }, null);

            Node.Popup.Insert(DeleteAction);

            JAction InsertAction = new JAction("New", "Automation.JASubsidiaries.InsertForm");

            Node.Popup.Insert(InsertAction);

            return(Node);
        }