Ejemplo n.º 1
0
 public void PopulateBusinessObjectFromReader(HPS.BLL.VersionBLL.BLLVersion_T businessObject, IDataReader dataReader)
 {
     businessObject.VersionID_int = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.VersionBLL.BLLVersion_T.Version_TField.VersionID_int.ToString()));
     businessObject.Version_nvc   = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.VersionBLL.BLLVersion_T.Version_TField.Version_nvc.ToString()));
     businessObject.Date_nvc      = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.VersionBLL.BLLVersion_T.Version_TField.Date_nvc.ToString()));
     businessObject.Time_nvc      = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.VersionBLL.BLLVersion_T.Version_TField.Time_nvc.ToString()));
 }
Ejemplo n.º 2
0
        public List <HPS.BLL.VersionBLL.BLLVersion_T> PopulateObjectsFromReader(IDataReader dataReader)
        {
            List <HPS.BLL.VersionBLL.BLLVersion_T> list = new List <HPS.BLL.VersionBLL.BLLVersion_T>();

            while (dataReader.Read())
            {
                HPS.BLL.VersionBLL.BLLVersion_T businessObject = new HPS.BLL.VersionBLL.BLLVersion_T();
                PopulateBusinessObjectFromReader(businessObject, dataReader);
                list.Add(businessObject);
            }
            return(list);
        }
Ejemplo n.º 3
0
        public void Insert(HPS.BLL.VersionBLL.BLLVersion_T businessObject)
        {
            try
            {
                if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "VersionID_bint") == false)
                {
                    throw new Hepsa.Core.Validation.InvalidBusinessObjectException(businessObject.BrokenRulesList().ToString());
                }

                _dataObject.Insert(businessObject);
            }
            catch (System.Exception ex)
            {
                throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
            }
        }
Ejemplo n.º 4
0
        public void Insert(HPS.BLL.VersionBLL.BLLVersion_T businessObject)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

            this.Command.CommandText = "[sp_Version_T_Add]";
            this.Command.CommandType = CommandType.StoredProcedure;

            try
            {
                this.Command.Parameters.Clear();

                SqlParameter VersionID_int = new SqlParameter();
                VersionID_int.ParameterName = "@VersionID_int";
                VersionID_int.SqlDbType     = SqlDbType.Int;
                VersionID_int.Direction     = ParameterDirection.Output;
                VersionID_int.IsNullable    = false;
                this.Command.Parameters.Add(VersionID_int);

                SqlParameter Version_nvc = new SqlParameter();
                Version_nvc.ParameterName = "@Version_nvc";
                Version_nvc.SqlDbType     = SqlDbType.NVarChar;
                Version_nvc.Direction     = ParameterDirection.Input;
                Version_nvc.IsNullable    = false;
                Version_nvc.Value         = businessObject.Version_nvc;
                this.Command.Parameters.Add(Version_nvc);

                SqlParameter Date_nvc = new SqlParameter();
                Date_nvc.ParameterName = "@Date_nvc";
                Date_nvc.SqlDbType     = SqlDbType.NVarChar;
                Date_nvc.Direction     = ParameterDirection.Input;
                Date_nvc.IsNullable    = false;
                Date_nvc.Value         = businessObject.Date_nvc;
                this.Command.Parameters.Add(Date_nvc);

                SqlParameter Time_nvc = new SqlParameter();
                Time_nvc.ParameterName = "@Time_nvc";
                Time_nvc.SqlDbType     = SqlDbType.NVarChar;
                Time_nvc.Direction     = ParameterDirection.Input;
                Time_nvc.IsNullable    = false;
                Time_nvc.Value         = businessObject.Time_nvc;
                this.Command.Parameters.Add(Time_nvc);


                if (ControlConnection)
                {
                    this.BeginTransaction();
                }

                this.Command.ExecuteNonQuery();

                businessObject.VersionID_int = (Int32?)(this.Command.Parameters["@VersionID_int"].Value);

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Ejemplo n.º 5
0
        private void Login_Load(object sender, EventArgs e)
        {
            string s = Hepsa.Core.Common.ApplicationInfo.MacAddress;

            if (string.IsNullOrEmpty(Hepsa.Core.Common.ConnectionString.ConnectionString))
            {
                HPS.Present.SQL.SQLConnectionManager sqlManager = new HPS.Present.SQL.SQLConnectionManager(HPS.Present.SQL.SQLConnectionManager.enumCloseMode.EndProgram);
                sqlManager.ShowDialog();
            }
            HPS.BLL.BLLYear_T year = null;
            Hepsa.Core.Common.ConnectionString.DataBase = Properties.Settings.Default.DataBaseName;
            try
            {
                LoadFiscalYearCombo();
            }
            catch (Exception ex)
            {
                HPS.Present.SQL.SQLConnectionManager sqlManager = new HPS.Present.SQL.SQLConnectionManager(HPS.Present.SQL.SQLConnectionManager.enumCloseMode.EndProgram);
                sqlManager.ShowDialog();
                LoadFiscalYearCombo();
            }

            if (HPS.Common.CurrentUser.Year != null)
            {
                YearEntity = HPS.Common.CurrentUser.Year;
                HPS.Common.CurrentUser.Year = null;
            }


            //while (true)
            //{
            HPS.BLL.UserBLL.BLLUser_TFactory UserFactory = new HPS.BLL.UserBLL.BLLUser_TFactory();
            try
            {
                HPS.BLL.VersionBLL.BLLVersion_TFactory VersionFactory = new HPS.BLL.VersionBLL.BLLVersion_TFactory();
                string DBVersion_nvc = string.Empty;
                VersionFactory.SelectLastOldVersion(out DBVersion_nvc);

                string APPVersion = Assembly.GetEntryAssembly().GetName().Version.ToString();
                APPVersion = APPVersion.Substring(0, APPVersion.Length - 2);
                string[] splitedVersion = APPVersion.Split('.');
                if (splitedVersion[1].Length == 1)
                {
                    splitedVersion[1] = "0" + splitedVersion[1];
                }
                if (splitedVersion[2].Length == 1)
                {
                    splitedVersion[2] = "0" + splitedVersion[2];
                }
                APPVersion = splitedVersion[0] + "/" + splitedVersion[1] + "/" + splitedVersion[2];
                if (string.IsNullOrEmpty(DBVersion_nvc))
                {
                    HPS.BLL.VersionBLL.BLLVersion_T VersionEntity = new HPS.BLL.VersionBLL.BLLVersion_T();
                    VersionEntity.Version_nvc = APPVersion;
                    VersionEntity.Date_nvc    = VersionFactory.ServerJalaliDate;
                    VersionEntity.Time_nvc    = VersionFactory.ServerTime;
                    VersionFactory.Insert(VersionEntity);
                }
                else
                {
                    // \\172.24.129.5\exe\
                    // \\192.168.200.50\exe\
                    //
                    if (DBVersion_nvc.CompareTo(APPVersion) > 0)
                    {
                        throw new ApplicationException("نسخه اجرایی شما قدیمی است لطفاً به روز رسانی نمایید");
                    }
                    else if (DBVersion_nvc.CompareTo(APPVersion) < 0)
                    {
                        HPS.BLL.VersionBLL.BLLVersion_T VersionEntity = new HPS.BLL.VersionBLL.BLLVersion_T();
                        VersionEntity.Version_nvc = APPVersion;
                        VersionEntity.Date_nvc    = VersionFactory.ServerJalaliDate;
                        VersionEntity.Time_nvc    = VersionFactory.ServerTime;
                        VersionFactory.Insert(VersionEntity);
                    }
                }
                if (YearEntity != null)
                {
                    HPS.Common.CurrentUser.Year = YearEntity;
                }
                //              If FiscalYearEntity IsNot Nothing Then
                //    HPS.Common.CurrentUser.FiscalYear = FiscalYearEntity
                //End If
            }
            catch (Exception ex)
            {
                if (ex.Message == "The ConnectionString property has not been initialized.")
                {
                    HPS.Present.SQL.SQLConnectionManager sqlManager = new HPS.Present.SQL.SQLConnectionManager(HPS.Present.SQL.SQLConnectionManager.enumCloseMode.EndProgram);
                    sqlManager.ShowDialog();
                }
                else
                {
                    Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
                    Environment.Exit(0);
                }
            }
            finally
            {
            }
            //}
            try
            {
                //TINYLib.Tiny tinylock = new TINYLib.Tiny();
                ////tinylock.ServerIP = Hepsa.Core.Common.ConnectionString.Server;
                //tinylock.Initialize = true;
                //if (tinylock.TinyErrCode != 0)
                //{
                //    throw new ApplicationException("خطا در اتصال به قفل");
                //}
                //tinylock.UserPassWord = "******";
                //tinylock.ShowTinyInfo = true;
                //if (tinylock.TinyErrCode != 0)
                //    throw new ApplicationException("خطا در اتصال به قفل");
                //if (tinylock.SerialNumber != "2039-8806-1473")
                //    throw new ApplicationException("قفل مورد استفاده نامعتبر می باشد");
            }

            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
                Environment.Exit(0);
            }
        }