Наследование: MonoBehaviour
Пример #1
0
 public Stairs(Common.DataModel.Stairs stairs)
 {
     Level = stairs.Level;
     Capacity = stairs.Capacity;
     EntranceCapacity = stairs.EntranceCapacity;
     Delay = stairs.Delay;
 }
Пример #2
0
        protected override void InitializeParameter(System.Data.IDbDataParameter p, Common.NamedParameter parameter, object value)
        {
            var sqlType = parameter.SqlType;

            if (parameter.SqlType != null)
            {
                if (sqlType.Length > 0)
                    p.Size = sqlType.Length;
                if (sqlType.Precision > 0)
                    p.Precision = sqlType.Precision;
                if (sqlType.Scale > 0)
                    p.Scale = sqlType.Scale;
                if (sqlType.Required)
                    (p as DbParameter).IsNullable = false;

                if (value != null && value is DateTime)
                {
                    var dt = (DateTime)value;
                    switch (sqlType.DbType)
                    {
                        case DBType.DateTime:
                        case DBType.NVarChar:
                            sqlType = SqlType.Get(DBType.NVarChar, 100);
                            value = dt.ToString(fmt);
                            break;

                    }
                }
            }
            p.ParameterName = parameter.Name;
            p.Value = value ?? DBNull.Value;
            ConvertDBTypeToNativeType(p, sqlType.DbType);
        }
Пример #3
0
		protected void imgSaveAddItem_Click(object sender, System.EventArgs e)
		{
			Int64 RetID = SaveRecord();
			Common Common = new Common();
			string stParam = "?task=" + Common.Encrypt("additem",Session.SessionID) + "&retid=" + Common.Encrypt(RetID.ToString(),Session.SessionID) + "#itemsection";	
			Response.Redirect("Default.aspx" + stParam);	
		}
Пример #4
0
        public static Common.Models.Events.EventMatter Create(Common.Models.Events.EventMatter model,
            Common.Models.Account.Users creator,
            IDbConnection conn = null, bool closeConnection = true)
        {
            DBOs.Events.EventMatter dbo;
            Common.Models.Events.EventMatter currentModel;

            if (!model.Id.HasValue) model.Id = Guid.NewGuid();
            model.Created = model.Modified = DateTime.UtcNow;
            model.CreatedBy = model.ModifiedBy = creator;

            currentModel = Get(model.Event.Id.Value, model.Matter.Id.Value);

            if (currentModel != null) 
                return currentModel;

            dbo = Mapper.Map<DBOs.Events.EventMatter>(model);

            conn = DataHelper.OpenIfNeeded(conn);

            throw new Exception("this is broke");
            conn.Execute("UPDATE \"event_assigned_conttter\" (\"id\", \"event_id\", \"matter_id\", \"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " +
                "VALUES (@Id, @EventId, @MatterId, @UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)",
                dbo);
            DataHelper.Close(conn, closeConnection);

            return model;
        }
Пример #5
0
        protected override void SendNotification(Common.Notification notification)
        {
            var bbn = notification as BlackberryNotification;

            if (bbn != null)
                push(bbn);
        }
 public TerrainGeometryWaterBrushCatalogResource(int APIversion,
     uint version,
     uint brushVersion,
     Common common,
     BrushOperation normalOperation,
     BrushOperation oppositeOperation,
     TGIBlock profileTexture,
     BrushOrientation orientation,
     float width,
     float strength,
     byte baseTextureValue,
     float wiggleAmount
     )
     : base(APIversion, version, common)
 {
     this.brushVersion = brushVersion;
     this.normalOperation = normalOperation;
     this.oppositeOperation = oppositeOperation;
     this.profileTexture = profileTexture;
     this.orientation = orientation;
     this.width = width;
     this.strength = strength;
     this.baseTextureValue = baseTextureValue;
     this.wiggleAmount = wiggleAmount;
 }
Пример #7
0
        public static Common.Models.Documents.DocumentTask Create(Common.Models.Documents.DocumentTask model,
            Common.Models.Account.Users creator)
        {
            model.Created = model.Modified = DateTime.UtcNow;
            model.CreatedBy = model.ModifiedBy = creator;
            DBOs.Documents.DocumentTask dbo = Mapper.Map<DBOs.Documents.DocumentTask>(model);

            using (IDbConnection conn = Database.Instance.GetConnection())
            {
                Common.Models.Documents.DocumentTask currentModel = Get(model.Task.Id.Value, model.Document.Id.Value);

                if (currentModel != null)
                { // Update
                    conn.Execute("UPDATE \"document_task\" SET \"utc_modified\"=@UtcModified, \"modified_by_user_pid\"=@ModifiedByUserPId " +
                        "\"utc_disabled\"=null, \"disabled_by_user_pid\"=null WHERE \"id\"=@Id", dbo);
                    model.Created = currentModel.Created;
                    model.CreatedBy = currentModel.CreatedBy;
                }
                else
                { // Create
                    conn.Execute("INSERT INTO \"document_task\" (\"id\", \"document_id\", \"task_id\", \"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " +
                        "VALUES (@Id, @DocumentId, @TaskId, @UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)",
                        dbo);
                }
            }

            return model;
        }
 protected override void InternalSetProcessorVolume(int newVol, int maxVol, Common.MuteState muteState)
 {
     if (_processor != null)
     {
         switch (muteState)
         {
             case Common.MuteState.Normal:
                 {
                     if (newVol < 1)
                         _processor.CurrentVolume = 0.0f; //mute...
                     else
                     {
                         float tmpVol = (float)Math.Min(newVol, maxVol);
                         _processor.CurrentVolume = (float)(tmpVol / maxVol);
                     }
                     break;
                 }
             case Common.MuteState.Muted:
                 {
                     _processor.CurrentVolume = 0f;
                     break;
                 }
             case Common.MuteState.AutoMuted:
                 {
                     _processor.CurrentVolume = 0f;
                     break;
                 }
         }
     }
 }
Пример #9
0
		internal FResults(ref Common.Interface newCommon)
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			CommonCode = newCommon;

			Trace.WriteLine("FResults: Creating");
			try
			{
				this.Resize += new EventHandler(FStations_Resize);

				// Databinding
				ddPatrols.DataSource = patrolsDs.Patrols;
				ddPatrols.DisplayMember = "DisplayName";
				ddPatrols.ValueMember = "Id";

				ddCompetitors.DataSource = this.competitorsDs.Shooters;
				ddCompetitors.DisplayMember = "Name";
				ddCompetitors.ValueMember = "Id";
			}
			catch(Exception exc)
			{
				Trace.WriteLine("FResults: Exception" + exc.ToString());
				throw;
			}
			finally
			{
				Trace.WriteLine("FResults: Created.");
			}
		}
Пример #10
0
 public WallCatalogResource(int APIversion,
     uint version,
     uint unknown2,
     Common common,
     Wall wallType,
     Partition partitionType,
     PartitionFlagsType partitionFlags,
     VerticalSpan verticalSpanType,
     PartitionsBlockedFlagsType partitionsBlockedFlags,
     PartitionsBlockedFlagsType adjacentPartitionsBlockedFlags,
     PartitionTool partitionToolMode,
     ToolUsageFlagsType toolUsageFlags,
     uint defaultPatternIndex,
     WallThickness wallThicknessType,
     TGIBlockList ltgib)
     : base(APIversion, version, common, ltgib)
 {
     this.unknown2 = unknown2;
     this.wallType = wallType;
     this.partitionType = partitionType;
     this.partitionFlags = partitionFlags;
     this.verticalSpanType = verticalSpanType;
     this.partitionsBlockedFlags = partitionsBlockedFlags;
     this.adjacentPartitionsBlockedFlags = adjacentPartitionsBlockedFlags;
     this.partitionToolMode = partitionToolMode;
     this.toolUsageFlags = toolUsageFlags;
     this.defaultPatternIndex = defaultPatternIndex;
     this.wallThicknessType = wallThicknessType;
 }
Пример #11
0
        public int Update(Common.DataContext ctx, IModel.BaseTable baseTable)
        {
            int rel = 0;
            rel = dal.Update(ctx, baseTable);

            return rel;
        }
Пример #12
0
 public Endpoint(Configuration.ISettings configurationSettings, Common.Connection.IFactory connectionFactory, Common.Routing.IKey routingKey, Common.Queue.IName queueName)
 {
     _configurationSettings = configurationSettings;
     _connectionFactory = connectionFactory;
     _routingKey = routingKey;
     _queueName = queueName;
 }
Пример #13
0
        public static Common.Models.Events.EventNote Create(Common.Models.Events.EventNote model,
            Common.Models.Account.Users creator,
            IDbConnection conn = null, bool closeConnection = true)
        {
            model.Created = model.Modified = DateTime.UtcNow;
            model.CreatedBy = model.ModifiedBy = creator;
            DBOs.Events.EventNote dbo = Mapper.Map<DBOs.Events.EventNote>(model);

            conn = DataHelper.OpenIfNeeded(conn);

            Common.Models.Events.EventNote currentModel = Get(model.Event.Id.Value, model.Note.Id.Value, conn, false);

            if (currentModel != null)
            { // Update
                conn.Execute("UPDATE \"event_note\" SET \"utc_modified\"=@UtcModified, \"modified_by_user_pid\"=@ModifiedByUserPId " +
                    "\"utc_disabled\"=null, \"disabled_by_user_pid\"=null WHERE \"id\"=@Id", dbo);
                model.Created = currentModel.Created;
                model.CreatedBy = currentModel.CreatedBy;
            }
            else
            { // Create
                if (conn.Execute("INSERT INTO \"event_note\" (\"id\", \"note_id\", \"event_id\", \"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " +
                    "VALUES (@Id, @NoteId, @EventId, @UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)",
                    dbo) > 0)
                    model.Id = conn.Query<DBOs.Events.EventNote>("SELECT currval(pg_get_serial_sequence('event_note', 'id')) AS \"id\"").Single().Id;
            }

            DataHelper.Close(conn, closeConnection);

            return model;
        }
Пример #14
0
 public void SetUser(Common.UserInfo loginuser)
 {
     _user = loginuser;
     this.usernamelabel.Text = _user.UserName;
     this.whcodelabel.Text = _user.Whcode;
     this.statuslabel.Text = _user.Status;
 }
Пример #15
0
 public SymbolEvent(Common.SafeBitArray bitset, int samplesPerSymbol, bool decision, Shift shift)
 {
     mBitset = bitset;
     mSamplesPerSymbol = samplesPerSymbol;
     mDecision = decision;
     mShift = shift;
 }
Пример #16
0
        public static Common.Models.Billing.InvoiceFee Create(Common.Models.Billing.InvoiceFee model,
            Common.Models.Account.Users creator,
            IDbConnection conn = null, bool closeConnection = true)
        {
            if (!model.Id.HasValue) model.Id = Guid.NewGuid();
            model.Created = model.Modified = DateTime.UtcNow;
            model.CreatedBy = model.ModifiedBy = creator;
            DBOs.Billing.InvoiceFee dbo = Mapper.Map<DBOs.Billing.InvoiceFee>(model);

            conn = OpenIfNeeded(conn);

            Common.Models.Billing.InvoiceFee currentModel = Get(model.Invoice.Id.Value, model.Fee.Id.Value);

            if (currentModel != null)
            { // Update
                conn.Execute("UPDATE \"invoice_fee\" SET \"utc_modified\"=@UtcModified, \"modified_by_user_pid\"=@ModifiedByUserPId " +
                    "\"utc_disabled\"=null, \"disabled_by_user_pid\"=null WHERE \"id\"=@Id", dbo);
                model.Created = currentModel.Created;
                model.CreatedBy = currentModel.CreatedBy;
            }
            else
            { // Create
                conn.Execute("INSERT INTO \"invoice_fee\" (\"id\", \"fee_id\", \"invoice_id\", \"amount\", \"details\", \"tax_amount\", \"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " +
                    "VALUES (@Id, @FeeId, @InvoiceId, @Amount, @Details, @TaxAmount, @UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)",
                    dbo);
            }

            Close(conn, closeConnection);

            return model;
        }
Пример #17
0
 private static void BindList(ListControl listControl, Common.Data.Table.MDataTable source)
 {
     listControl.DataSource = source;
     listControl.DataTextField = source.Columns[0].ColumnName;
     listControl.DataValueField = source.Columns[1].ColumnName;
     listControl.DataBind();
 }
Пример #18
0
 public virtual void AddInteraction(Common.InteractionInjectorList interactions)
 {
     if (!Common.AssemblyCheck.IsInstalled("NRaasShooless"))
     {
         interactions.Replace<IShowerable, Shower.TakeShower.Definition>(Singleton);
     }
 }
        public void Store(Common.Infrastructure.Contexts.MessageContext messageContext, System.Collections.Generic.IDictionary<string, object> snapshot)
        {
            string message = null;
            try
            {
                message = JsonConvert.SerializeObject(new
                {
                    
                });
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(string.Format("Error serializing exception {0}", ex.Message));

                if (PassportSettings.Settings.ThrowOnError)
                {
                    throw;
                }
            }

            if (message == null) return;
            try
            {
                Logger.Current().AddLine(message);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(string.Format("Error Logging Exception to Logentries {0}", ex.Message));

                if (PassportSettings.Settings.ThrowOnError)
                {
                    throw;
                }
            }
        }
Пример #20
0
        /// <summary>
        /// Should always be created through Backend.CreateSpriteBatch
        /// </summary>
        internal SpriteBatch(Backend backend, Renderer.RenderSystem renderSystem, Common.ResourceManager resourceManager)
        {
            if (backend == null)
                throw new ArgumentNullException("backend");
            if (renderSystem == null)
                throw new ArgumentNullException("renderSystem");
            if (resourceManager == null)
                throw new ArgumentNullException("resourceManager");

            Backend = backend;

            Buffer = new BatchBuffer(renderSystem, new Renderer.VertexFormat(new Renderer.VertexFormatElement[]
                {
                    new Renderer.VertexFormatElement(Renderer.VertexFormatSemantic.Position, Renderer.VertexPointerType.Float, 3, 0),
                    new Renderer.VertexFormatElement(Renderer.VertexFormatSemantic.TexCoord, Renderer.VertexPointerType.Float, 2, sizeof(float) * 3),
                    new Renderer.VertexFormatElement(Renderer.VertexFormatSemantic.Color, Renderer.VertexPointerType.Float, 4, sizeof(float) * 5),
                }), 32);

            Shader = resourceManager.Load<Resources.ShaderProgram>("/shaders/sprite");
            ShaderSRGB = resourceManager.Load<Resources.ShaderProgram>("/shaders/sprite", "SRGB");

            Quads = new List<QuadInfo>();
            for (var i = 0; i < 32; i++)
            {
                Quads.Add(new QuadInfo());
            }

            RenderStateAlphaBlend = Backend.CreateRenderState(true, false, false, Renderer.BlendingFactorSrc.SrcAlpha, Renderer.BlendingFactorDest.OneMinusSrcAlpha, Renderer.CullFaceMode.Front);
            RenderStateNoAlphaBlend = Backend.CreateRenderState(false, false, false, Renderer.BlendingFactorSrc.Zero, Renderer.BlendingFactorDest.One, Renderer.CullFaceMode.Front);
        }
Пример #21
0
        public static SlimDX.Direct3D9.Mesh CreateMesh(Device device, Common.Map.Map map)
        {
            int terrainNW = map.Heightmap.GetLength(1);
            int terrainNH = map.Heightmap.GetLength(0);

            SlimDX.Direct3D9.Mesh terrainGrid;

            terrainGrid = Meshes.XPositionTexcoordNormal(device, Meshes.IndexedGrid(
                Vector3.Zero,
                new Vector2(map.Width, map.Height),
                terrainNW - 1, terrainNH - 1,
                new Vector2(0, 0),
                new Vector2(map.Width / 5, map.Height / 5)));

            DataStream ds = terrainGrid.VertexBuffer.Lock(0, 0, LockFlags.None);

            for (int y = 0; y < map.Heightmap.GetLength(1); y++)
            {
                for (int x = 0; x < map.Heightmap.GetLength(0); x++)
                {
                    ds.Write(new Vector3(x * Common.Config.TerrainGridSize, y * Common.Config.TerrainGridSize, map.Heightmap[y, x]));
                    ds.Seek(Vector2.SizeInBytes + Vector3.SizeInBytes, SeekOrigin.Current);
                }
            }

            terrainGrid.VertexBuffer.Unlock();

            return terrainGrid;
        }
Пример #22
0
        public void Turn(Common.TurnDirection direction)
        {
            int newDirection = 0;
            if (direction == Common.TurnDirection.L)
            {
                newDirection = (int)this.RoverDirection + 1;
            }
            else
            {
                newDirection = (int)this.RoverDirection - 1;
            }

            if (newDirection < 0)
            {
                this.RoverDirection = Common.Direction.S;
            }
            else if (newDirection > 3)
            {
                this.RoverDirection = Common.Direction.E;
            }
            else
            {
                this.RoverDirection = (Common.Direction)newDirection;
            }
        }
        public static void LogEx(this Common.Logging.ILog log, Common.Logging.LogLevel level, Action<TraceRecord> traceAction, [CallerMemberName] string member = "", [CallerLineNumber] int line = 0)
        {
            // Check if this log level is enabled
            if (level == LogLevel.Trace && log.IsTraceEnabled == false ||
                level == LogLevel.Debug && log.IsDebugEnabled == false ||
               level == LogLevel.Info && (log.IsInfoEnabled == false) ||
               level == LogLevel.Warn && (log.IsWarnEnabled == false) ||
               level == LogLevel.Error && (log.IsErrorEnabled == false) ||
               level == LogLevel.Fatal && (log.IsFatalEnabled == false))
            {
                return;
            }

            TraceRecord tr = new TraceRecord() { Level = level };
            traceAction(tr);
            string message = String.Format("{0}() line {1}: {2}.{3}", member, line, tr.Message, (tr.Data != null) ? Newtonsoft.Json.JsonConvert.SerializeObject(tr.Data) : "");

            switch (level)
            {
                case LogLevel.Trace: log.Trace(message, tr.Exception); break;
                case LogLevel.Debug: log.Debug(message, tr.Exception); break;
                case LogLevel.Error: log.Error(message, tr.Exception); break;
                case LogLevel.Fatal: log.Fatal(message, tr.Exception); break;
                case LogLevel.Info: log.Info(message, tr.Exception); break;
                case LogLevel.Warn: log.Warn(message, tr.Exception); break;
            }
        }
 public override void GetTables(Common.Entities.MetaDataSchema.Project project)
 {
     foreach (Entities.MetaDataSchema.Database dbase in project.Databases)
     {
         System.Data.DataTable tables = new DataTable();
         System.Data.DataTable sqlServerTable = new DataTable();
         tables.Load(project.ExtractorManager.SelectStatement("Select * From " + dbase.Name + ".INFORMATION_SCHEMA.TABLES Where Table_Type = '" + Resources.DataStructure.TableType + "'"), LoadOption.OverwriteChanges);
         sqlServerTable.Load(project.ExtractorManager.SelectStatement("Select * From " + dbase.Name + ".sys.all_objects Where Type_Desc = 'user_table'"), LoadOption.OverwriteChanges);
         OnStartLoading(new Common.Events.LoadingEventArgs(dbase.Name,"Tables","Database"));
         dbase.Tables.Clear();
         foreach (DataRow row in tables.Rows)
         {
             
             Entities.MetaDataSchema.Table tbl = new Common.Entities.MetaDataSchema.Table();
             tbl.ParentDatabase = dbase;
             tbl.Schema = row["Table_Schema"].ToString();
             tbl.Name = row["Table_Name"].ToString();
             DataRow[] sqlRows = sqlServerTable.Select("[name] = '" + tbl.Name + "'");
             if (sqlRows.Length > 0)
             {
                 tbl.TableID = sqlRows[0]["object_id"].ToString();
             }
             if (project.CheckHasData)
             {
                 tbl.DataCount = CountRecordsInTable(tbl);
                 tbl.HasData = tbl.DataCount > 0;
             }
             dbase.Tables.Add(tbl);
         }
         OnEndLoading(new Common.Events.LoadingEventArgs(dbase.Name, "Tables","Database"));
         tables.Dispose();
     }
     GC.Collect();
 }
Пример #25
0
        private static GameDetails GetUSGameDetails(string psnId, string gameId, Common.Login login)
        {
            Core.US.Collector collector = new US.Collector(psnId);
            collector.GetGameDetails(gameId, login);

            return null;
        }
Пример #26
0
 public void Create(Common.Models.Meal meal)
 {
     using (var client = GetClient())
     {
         client.CreateDocumentAsync(GetCollection().DocumentsLink, meal).Wait();
     }
 }
 public override void GetTables(Common.Entities.MetaDataSchema.Database database)
 {
     System.Data.DataTable tables = new DataTable();
     System.Data.DataTable sqlServerTable = new DataTable();
     tables.Load(database.ParentProject.ExtractorManager.SelectStatement(String.Format("Select * From {0}.INFORMATION_SCHEMA.TABLES Where Table_Type = '{1}'", database.Name, Resources.DataStructure.TableType)), LoadOption.OverwriteChanges);
     sqlServerTable.Load(database.ParentProject.ExtractorManager.SelectStatement(String.Format("Select * From {0}.sys.all_objects Where Type_Desc = 'user_table'", database.Name)), LoadOption.OverwriteChanges);
     database.Tables.Clear();
     foreach (DataRow row in tables.Rows)
     {
         Entities.MetaDataSchema.Table tbl = new Common.Entities.MetaDataSchema.Table();
         
         tbl.ParentDatabase = database;
         tbl.Schema = row["Table_Schema"].ToString();
         tbl.Name = row["Table_Name"].ToString();
         DataRow[] sqlRows = sqlServerTable.Select("[name] = '" + tbl.Name + "'");
         if (sqlRows.Length > 0)
         {
             tbl.TableID = sqlRows[0]["object_id"].ToString();
         }
         if(database.ParentProject.CheckHasData)
         {
             tbl.DataCount = CountRecordsInTable(tbl);
             tbl.HasData = tbl.DataCount > 0;
         }
         database.Tables.Add(tbl);
     }
 }
Пример #28
0
 public void IncStat(string stat, Common.DebugLevel minLevel)
 {
     if (DebuggingLevel >= minLevel)
     {
         IncStat(stat);
     }
 }
Пример #29
0
        public static Common.Models.Notes.NoteNotification Create(Common.Models.Notes.NoteNotification model,
            Common.Models.Account.Users creator)
        {
            if (!model.Id.HasValue) model.Id = Guid.NewGuid();
            model.Created = model.Modified = DateTime.UtcNow;
            model.CreatedBy = model.ModifiedBy = creator;
            DBOs.Notes.NoteNotification dbo = Mapper.Map<DBOs.Notes.NoteNotification>(model);

            using (IDbConnection conn = Database.Instance.GetConnection())
            {
                Common.Models.Notes.NoteNotification currentModel = Get(model.Note.Id.Value, model.Contact.Id.Value);

                if (currentModel != null)
                { // Update
                    dbo = Mapper.Map<DBOs.Notes.NoteNotification>(currentModel);
                    conn.Execute("UPDATE \"note_notification\" SET \"utc_modified\"=@UtcModified, \"modified_by_user_pid\"=@ModifiedByUserPId, " +
                        "\"utc_disabled\"=null, \"disabled_by_user_pid\"=null, \"cleared\"=null WHERE \"id\"=@Id", dbo);
                    model.Created = currentModel.Created;
                    model.CreatedBy = currentModel.CreatedBy;
                }
                else
                { // Create
                    conn.Execute("INSERT INTO \"note_notification\" (\"id\", \"note_id\", \"contact_id\", \"cleared\", \"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " +
                        "VALUES (@Id, @NoteId, @ContactId, @Cleared, @UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)",
                        dbo);
                }
            }

            return model;
        }
Пример #30
0
        public Model.General.ReturnValueInfo Save(Model.IModel.IModelObject itemEntity, Common.DefineConstantValue.EditStateEnum EditMode)
        {
            ReturnValueInfo returnInfo = new ReturnValueInfo(false);

            ConsumeMachineMaster_cmm_Info objInfo = itemEntity as ConsumeMachineMaster_cmm_Info;

            try
            {
                switch (EditMode)
                {
                    case Common.DefineConstantValue.EditStateEnum.OE_Insert:
                        objInfo.cmm_dAddDate = DateTime.Now;
                        objInfo.cmm_dLastDate = DateTime.Now;
                        objInfo.cmm_dLastAccessTime = DateTime.Now;
                        objInfo.cmm_cRecordID = Guid.NewGuid();
                        returnInfo = _icmDA.InsertRecord(objInfo);
                        break;
                    case Common.DefineConstantValue.EditStateEnum.OE_Update:
                        objInfo.cmm_dLastDate = DateTime.Now;
                        returnInfo = _icmDA.UpdateRecord(objInfo);
                        break;
                }
            }
            catch
            {
                throw;
            }

            return returnInfo;
        }
    protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
    {
        if (e.CommandName == "QuickUpdate")
        {
            string ProductCategoryID, IsShowOnMenu, IsShowOnHomePage, IsAvailable;
            var    oProductCategory = new ProductCategory();

            foreach (GridDataItem item in RadGrid1.Items)
            {
                ProductCategoryID = item.GetDataKeyValue("ProductCategoryID").ToString();
                IsShowOnMenu      = ((CheckBox)item.FindControl("chkIsShowOnMenu")).Checked.ToString();
                IsShowOnHomePage  = ((CheckBox)item.FindControl("chkIsShowOnHomePage")).Checked.ToString();
                IsAvailable       = ((CheckBox)item.FindControl("chkIsAvailable")).Checked.ToString();

                oProductCategory.ProductCategoryQuickUpdate(
                    ProductCategoryID,
                    IsShowOnMenu,
                    IsShowOnHomePage,
                    IsAvailable
                    );
            }
        }
        else if (e.CommandName == "DeleteSelected")
        {
            var oProductCategory = new ProductCategory();
            var errorList        = "";

            foreach (GridDataItem item in RadGrid1.SelectedItems)
            {
                var isChildCategoryExist  = oProductCategory.ProductCategoryIsChildrenExist(item.GetDataKeyValue("ProductCategoryID").ToString());
                var ProductCategoryName   = ((Label)item.FindControl("lblProductCategoryName")).Text;
                var ProductCategoryNameEn = ((Label)item.FindControl("lblProductCategoryNameEn")).Text;
                if (isChildCategoryExist)
                {
                    errorList += ", " + ProductCategoryName;
                }
                else
                {
                    string strImageName = ((HiddenField)item.FindControl("hdnImageName")).Value;

                    if (!string.IsNullOrEmpty(strImageName))
                    {
                        string strSavePath = Server.MapPath("~/res/productcategory/" + strImageName);
                        if (File.Exists(strSavePath))
                        {
                            File.Delete(strSavePath);
                        }
                    }
                }
            }
            if (!string.IsNullOrEmpty(errorList))
            {
                e.Canceled = true;
                string strAlertMessage = "Danh mục <b>\"" + errorList.Remove(0, 1).Trim() + "\"</b> đang có danh mục con hoặc sản phẩm.<br /> Xin xóa danh mục con hoặc sản phẩm trong danh mục này hoặc thiết lập hiển thị = \"không\".";
                lblError.Text = strAlertMessage;
            }
        }
        else if (e.CommandName == "PerformInsert" || e.CommandName == "Update")
        {
            var command       = e.CommandName;
            var row           = command == "PerformInsert" ? (GridEditFormInsertItem)e.Item : (GridEditFormItem)e.Item;
            var FileImageName = (RadUpload)row.FindControl("FileImageName");

            string strProductCategoryName          = ((RadTextBox)row.FindControl("txtProductCategoryName")).Text.Trim();
            string strProductCategoryNameEn        = ((RadTextBox)row.FindControl("txtProductCategoryNameEn")).Text.Trim();
            string strConvertedProductCategoryName = Common.ConvertTitle(strProductCategoryName);
            string strDescription       = HttpUtility.HtmlDecode(FCKEditorFix.Fix(((RadEditor)row.FindControl("txtDescription")).Content.Trim()));
            string strDescriptionEn     = HttpUtility.HtmlDecode(FCKEditorFix.Fix(((RadEditor)row.FindControl("txtDescriptionEn")).Content.Trim()));
            string strContent           = HttpUtility.HtmlDecode(FCKEditorFix.Fix(((RadEditor)row.FindControl("txtContent")).Content.Trim()));
            string strContentEn         = HttpUtility.HtmlDecode(FCKEditorFix.Fix(((RadEditor)row.FindControl("txtContentEn")).Content.Trim()));
            string strMetaTitle         = ((RadTextBox)row.FindControl("txtMetaTitle")).Text.Trim();
            string strMetaTitleEn       = ((RadTextBox)row.FindControl("txtMetaTitleEn")).Text.Trim();
            string strMetaDescription   = ((RadTextBox)row.FindControl("txtMetaDescription")).Text.Trim();
            string strMetaDescriptionEn = ((RadTextBox)row.FindControl("txtMetaDescriptionEn")).Text.Trim();
            string strImageName         = FileImageName.UploadedFiles.Count > 0 ? FileImageName.UploadedFiles[0].GetName() : "";
            string strParentID          = ((RadComboBox)row.FindControl("ddlParent")).SelectedValue;
            if ("".Equals(strParentID))
            {
                strParentID = "3";
            }
            string strIsAvailable      = ((CheckBox)row.FindControl("chkIsAvailable")).Checked.ToString();
            string strIsShowOnMenu     = ((CheckBox)row.FindControl("chkIsShowOnMenu")).Checked.ToString();
            string strIsShowOnHomePage = ((CheckBox)row.FindControl("chkIsShowOnHomePage")).Checked.ToString();


            var oProductCategory = new ProductCategory();

            if (e.CommandName == "PerformInsert")
            {
                strImageName = oProductCategory.ProductCategoryInsert(
                    strProductCategoryName,
                    strProductCategoryNameEn,
                    strConvertedProductCategoryName,
                    strDescription,
                    strDescriptionEn,
                    strContent,
                    strContentEn,
                    strMetaTitle,
                    strMetaTitleEn,
                    strMetaDescription,
                    strMetaDescriptionEn,
                    strImageName,
                    strParentID,
                    strIsShowOnMenu,
                    strIsShowOnHomePage,
                    strIsAvailable
                    );

                string strFullPath = "~/res/productcategory/" + strImageName;

                if (!string.IsNullOrEmpty(strImageName))
                {
                    FileImageName.UploadedFiles[0].SaveAs(Server.MapPath(strFullPath));
                    ResizeCropImage.ResizeByCondition(strFullPath, 57, 39);
                }
                RadGrid1.Rebind();
            }
            else
            {
                var dsUpdateParam        = ObjectDataSource1.UpdateParameters;
                var strProductCategoryID = row.GetDataKeyValue("ProductCategoryID").ToString();
                var strOldImageName      = ((HiddenField)row.FindControl("hdnImageName")).Value;
                var strOldImagePath      = Server.MapPath("~/res/productcategory/" + strOldImageName);

                dsUpdateParam["ProductCategoryName"].DefaultValue          = strProductCategoryName;
                dsUpdateParam["ProductCategoryNameEn"].DefaultValue        = strProductCategoryNameEn;
                dsUpdateParam["ConvertedProductCategoryName"].DefaultValue = strConvertedProductCategoryName;
                dsUpdateParam["Description"].DefaultValue      = strDescription;
                dsUpdateParam["DescriptionEn"].DefaultValue    = strDescriptionEn;
                dsUpdateParam["Content"].DefaultValue          = strContent;
                dsUpdateParam["ContentEn"].DefaultValue        = strContentEn;
                dsUpdateParam["ImageName"].DefaultValue        = strImageName;
                dsUpdateParam["ParentID"].DefaultValue         = strParentID;
                dsUpdateParam["IsShowOnMenu"].DefaultValue     = strIsShowOnMenu;
                dsUpdateParam["IsShowOnHomePage"].DefaultValue = strIsShowOnHomePage;
                dsUpdateParam["IsAvailable"].DefaultValue      = strIsAvailable;

                if (!string.IsNullOrEmpty(strImageName))
                {
                    var strFullPath = "~/res/productcategory/" + strConvertedProductCategoryName + "-" + strProductCategoryID + strImageName.Substring(strImageName.LastIndexOf('.'));

                    if (File.Exists(strOldImagePath))
                    {
                        File.Delete(strOldImagePath);
                    }

                    FileImageName.UploadedFiles[0].SaveAs(Server.MapPath(strFullPath));
                    ResizeCropImage.ResizeByCondition(strFullPath, 57, 39);
                }
            }
        }
        if (e.CommandName == "DeleteImage")
        {
            var oProductCategory = new ProductCategory();
            var lnkDeleteImage   = (LinkButton)e.CommandSource;
            var s = lnkDeleteImage.Attributes["rel"].ToString().Split('#');
            var strProductCategoryID = s[0];
            var strImageName         = s[1];

            oProductCategory.ProductCategoryImageDelete(strProductCategoryID);
            DeleteImage(strImageName);
            RadGrid1.Rebind();
        }
    }
Пример #32
0
        private void GetRepairInfo()
        {
            DataTable dt = DBHelper.GetTable("维修单详情", "tb_maintain_info a left join tb_maintain_settlement_info b on a.maintain_id=b.maintain_id ", "*", string.Format(" a.maintain_id='{0}'", strRepairId), "", "");

            if (dt.Rows.Count > 0)
            {
                #region 基本信息
                DataRow dr = dt.Rows[0];
                labMaintain_noS.Text = CommonCtrl.IsNullToString(dr["maintain_no"]); //维修单号
                string strReTime = CommonCtrl.IsNullToString(dr["reception_time"]);  //接待时间
                if (!string.IsNullOrEmpty(strReTime))
                {
                    labRTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strReTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labRTimeS.Text = string.Empty;
                }
                labCustomNOS.Text     = CommonCtrl.IsNullToString(dr["customer_code"]);                //客户编码
                labCustomNameS.Text   = CommonCtrl.IsNullToString(dr["customer_name"]);                //客户名称
                labContactS.Text      = CommonCtrl.IsNullToString(dr["linkman"]);                      //联系人
                labContactPhoneS.Text = CommonCtrl.IsNullToString(dr["link_man_mobile"]);              //联系人电话
                labCarNOS.Text        = CommonCtrl.IsNullToString(dr["vehicle_no"]);                   //车牌号
                labCarTypeS.Text      = GetDicName(CommonCtrl.IsNullToString(dr["vehicle_model"]));    //车型
                labCarBrandS.Text     = GetDicName(CommonCtrl.IsNullToString(dr["vehicle_brand"]));    //车辆品牌
                labVINS.Text          = CommonCtrl.IsNullToString(dr["vehicle_vin"]);                  //VIN
                labEngineNoS.Text     = CommonCtrl.IsNullToString(dr["engine_no"]);                    //发动机号
                labColorS.Text        = GetDicName(CommonCtrl.IsNullToString(dr["vehicle_color"]));    //颜色
                labDriverS.Text       = CommonCtrl.IsNullToString(dr["driver_name"]);                  //司机
                labDriverPhoneS.Text  = CommonCtrl.IsNullToString(dr["driver_mobile"]);                //司机手机
                labRepTypeS.Text      = GetDicName(CommonCtrl.IsNullToString(dr["maintain_type"]));    //维修类别
                labPayTypeS.Text      = GetDicName(CommonCtrl.IsNullToString(dr["maintain_payment"])); //维修付费方式
                labMlS.Text           = CommonCtrl.IsNullToString(dr["oil_into_factory"]);             //进场油量
                labMilS.Text          = CommonCtrl.IsNullToString(dr["travel_mileage"]);               //行驶里程
                labDescS.Text         = CommonCtrl.IsNullToString(dr["fault_describe"]);               //故障描述
                labRemarkS.Text       = CommonCtrl.IsNullToString(dr["remark"]);                       //备注
                if (CommonCtrl.IsNullToString(dr["orders_source"]) == "3")
                {
                    labStatusS.Text = "维修单结算" + DataSources.GetDescription(typeof(DataSources.EnumAuditStatus), int.Parse(CommonCtrl.IsNullToString(dr["info_status"])));;
                }
                else
                {
                    if (CommonCtrl.IsNullToString(dr["info_status"]) != Convert.ToInt32(DataSources.EnumAuditStatus.AUDIT).ToString())
                    {
                        labStatusS.Text = "接待" + DataSources.GetDescription(typeof(DataSources.EnumAuditStatus), int.Parse(CommonCtrl.IsNullToString(dr["info_status"])));
                    }
                    else
                    {
                        labStatusS.Text = DataSources.GetDescription(typeof(DataSources.EnumDispatchStatus), int.Parse(CommonCtrl.IsNullToString(dr["dispatch_status"])));//单据状态
                    }
                }

                labDepartS.Text       = GetDepartmentName(CommonCtrl.IsNullToString(dr["org_id"]));        //部门
                labAttnS.Text         = GetUserSetName(CommonCtrl.IsNullToString(dr["responsible_opid"])); //经办人
                labCreatePersonS.Text = CommonCtrl.IsNullToString(dr["create_name"]);                      //创建人
                string strCreateTime = CommonCtrl.IsNullToString(dr["create_time"]);                       //创建时间
                if (!string.IsNullOrEmpty(strCreateTime))
                {
                    labCreateTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strCreateTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labCreateTimeS.Text = string.Empty;
                }
                labFinallyPerS.Text = CommonCtrl.IsNullToString(dr["update_name"]);   //最后编辑人
                string strFinallyTime = CommonCtrl.IsNullToString(dr["update_time"]); //最后编辑时间
                if (!string.IsNullOrEmpty(strFinallyTime))
                {
                    labFinallyTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strFinallyTime)).ToString("yyyy-MM-dd HH:mm");
                }
                else
                {
                    labFinallyTimeS.Text = string.Empty;
                }
                labmaintain_manS.Text = CommonCtrl.IsNullToString(dr["maintain_man"]);//服务顾问

                #region 会员信息
                string strMemnerID = CommonCtrl.IsNullToString(dr["member_id"]);//会员信息Id
                if (!string.IsNullOrEmpty(strMemnerID))
                {
                    DataTable dct = DBHelper.GetTable("获取会员信息", "tb_customer", "member_number,member_class,accessories_discount,workhours_discount", " is_member='1' and cust_id='" + strMemnerID + "'", "", "");
                    labMemberNoS.Text    = CommonCtrl.IsNullToString(dr["member_number"]);        //会员卡号
                    labMemberGradeS.Text = CommonCtrl.IsNullToString(dr["member_class"]);         //会员等级
                    labMemberPZkS.Text   = CommonCtrl.IsNullToString(dr["workhours_discount"]);   //会员项目折扣
                    labMemberLZkS.Text   = CommonCtrl.IsNullToString(dr["accessories_discount"]); //会员用料折扣
                }
                else
                {
                    labMemberNoS.Text    = string.Empty; //会员卡号
                    labMemberGradeS.Text = string.Empty; //会员等级
                    labMemberPZkS.Text   = string.Empty; //会员项目折扣
                    labMemberLZkS.Text   = string.Empty;
                }
                #endregion
                labGshkS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["man_hour_sum_money"]), 2);   //工时货款
                labGsslS.Text       = CommonCtrl.IsNullToString(dr["man_hour_tax_rate"]);                                   //工时税率
                labGsseS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["man_hour_tax_rate"]), 2);    //工时税额
                labGssjhjS.Text     = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["man_hour_sum"]), 2);         //工时税价合计
                labPjhkS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["fitting_sum_money"]), 2);    //配件货款
                labPjslS.Text       = CommonCtrl.IsNullToString(dr["fitting_tax_rate"]);                                    //配件税率
                labPjseS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["fitting_tax_cost"]), 2);     //配件税额
                labPjsjhjS.Text     = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["fitting_sum"]), 2);          //配件税价合计
                labQtflS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["other_item_sum_money"]), 2); //其他项目费用
                QtslS.Text          = CommonCtrl.IsNullToString(dr["other_item_tax_rate"]);                                 //其他项目税率
                labQtseS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["other_item_tax_cost"]), 2);  //其他项目税额
                labQthjS.Text       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["other_item_sum"]), 2);       //其他项目价税合计
                labYH.Text          = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["privilege_cost"]), 2);       //优惠费用
                labShould.Text      = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["should_sum"]), 2);           //应收总额
                labReceive.Text     = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["received_sum"]), 2);         //实收总额
                labDebt.Text        = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dr["debt_cost"]), 2);            //欠款金额
                labInvoiceType.Text = CommonCtrl.IsNullToString(dr["make_invoice_type"]);                                   //开票类型
                labPayment.Text     = CommonCtrl.IsNullToString(dr["payment_terms"]);                                       //结算方式
                labSetAccount.Text  = CommonCtrl.IsNullToString(dr["settlement_account"]);                                  //结算账户
                labSetCompany.Text  = CommonCtrl.IsNullToString(dr["settle_company"]);                                      //结算单位
                #endregion

                #region 底部datagridview数据

                #region 维修项目数据
                //维修项目数据
                decimal   dcPmoney = 0;
                DataTable dpt      = DBHelper.GetTable("维修项目数据", "tb_maintain_item", "*", string.Format(" maintain_id='{0}'", strRepairId), "", "");;
                if (dpt.Rows.Count > 0)
                {
                    if (dpt.Rows.Count > dgvproject.Rows.Count)
                    {
                        dgvproject.Rows.Add(dpt.Rows.Count - dgvproject.Rows.Count + 1);
                    }
                    for (int i = 0; i < dpt.Rows.Count; i++)
                    {
                        DataRow dpr = dpt.Rows[i];
                        dgvproject.Rows[i].Cells["item_id"].Value                 = CommonCtrl.IsNullToString(dpr["item_id"]);
                        dgvproject.Rows[i].Cells["three_warranty"].Value          = CommonCtrl.IsNullToString(dpr["three_warranty"]) == "1" ? "是" : "否";
                        dgvproject.Rows[i].Cells["man_hour_type"].Value           = CommonCtrl.IsNullToString(dpr["man_hour_type"]);
                        dgvproject.Rows[i].Cells["item_no"].Value                 = CommonCtrl.IsNullToString(dpr["item_no"]);
                        dgvproject.Rows[i].Cells["item_name"].Value               = CommonCtrl.IsNullToString(dpr["item_name"]);
                        dgvproject.Rows[i].Cells["item_type"].Value               = CommonCtrl.IsNullToString(dpr["item_type"]);
                        dgvproject.Rows[i].Cells["man_hour_quantity"].Value       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["man_hour_quantity"]), 1);
                        dgvproject.Rows[i].Cells["man_hour_norm_unitprice"].Value = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["man_hour_norm_unitprice"]), 2);
                        dgvproject.Rows[i].Cells["remarks"].Value                 = CommonCtrl.IsNullToString(dpr["remarks"]);
                        dgvproject.Rows[i].Cells["sum_money_goods"].Value         = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["sum_money_goods"]), 2);
                        dgvproject.Rows[i].Cells["member_discount"].Value         = CommonCtrl.IsNullToString(dpr["member_discount"]);
                        dgvproject.Rows[i].Cells["member_price"].Value            = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["member_price"]), 2);
                        dgvproject.Rows[i].Cells["member_sum_money"].Value        = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dpr["member_sum_money"]), 2);
                    }
                }
                #endregion

                #region 维修用料数据
                //维修用料数据
                decimal   dcMmoney = 0;
                DataTable dmt      = DBHelper.GetTable("维修用料数据", "tb_maintain_material_detail", "*", string.Format(" maintain_id='{0}'", strRepairId), "", "");
                if (dmt.Rows.Count > 0)
                {
                    if (dmt.Rows.Count > dgvMaterials.Rows.Count)
                    {
                        dgvMaterials.Rows.Add(dmt.Rows.Count - dgvMaterials.Rows.Count + 1);
                    }
                    for (int i = 0; i < dmt.Rows.Count; i++)
                    {
                        DataRow dmr = dmt.Rows[i];
                        dgvMaterials.Rows[i].Cells["material_id"].Value      = CommonCtrl.IsNullToString(dmr["material_id"]);
                        dgvMaterials.Rows[i].Cells["parts_code"].Value       = CommonCtrl.IsNullToString(dmr["parts_code"]);
                        dgvMaterials.Rows[i].Cells["parts_name"].Value       = CommonCtrl.IsNullToString(dmr["parts_name"]);
                        dgvMaterials.Rows[i].Cells["norms"].Value            = CommonCtrl.IsNullToString(dmr["norms"]);
                        dgvMaterials.Rows[i].Cells["unit"].Value             = CommonCtrl.IsNullToString(dmr["unit"]);
                        dgvMaterials.Rows[i].Cells["quantity"].Value         = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dmr["quantity"]), 1);
                        dgvMaterials.Rows[i].Cells["unit_price"].Value       = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dmr["unit_price"]), 2);
                        dgvMaterials.Rows[i].Cells["Mmember_discount"].Value = CommonCtrl.IsNullToString(dmr["member_discount"]);
                        dgvMaterials.Rows[i].Cells["Mmember_price"].Value    = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dmr["member_price"]), 2);
                        dgvMaterials.Rows[i].Cells["sum_money"].Value        = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dmr["sum_money"]), 2);
                        dgvMaterials.Rows[i].Cells["drawn_no"].Value         = CommonCtrl.IsNullToString(dmr["drawn_no"]);
                        dgvMaterials.Rows[i].Cells["vehicle_brand"].Value    = CommonCtrl.IsNullToString(dmr["vehicle_brand"]);
                        dgvMaterials.Rows[i].Cells["Mthree_warranty"].Value  = CommonCtrl.IsNullToString(dmr["three_warranty"]) == "1" ? "是" : "否";
                        dgvMaterials.Rows[i].Cells["Mremarks"].Value         = CommonCtrl.IsNullToString(dmr["remarks"]);
                        dgvMaterials.Rows[i].Cells["whether_imported"].Value = CommonCtrl.IsNullToString(dmr["whether_imported"]) == "1" ? "是" : "否";
                    }
                }
                #endregion

                #region 其他项目收费数据
                //其他项目收费数据
                decimal   doMmoney = 0;
                DataTable dot      = DBHelper.GetTable("其他项目收费数据", "tb_maintain_other_toll", "*", string.Format(" maintain_id='{0}'", strRepairId), "", "");
                if (dot.Rows.Count > 0)
                {
                    if (dot.Rows.Count > dgvOther.Rows.Count)
                    {
                        dgvOther.Rows.Add(dot.Rows.Count - dgvOther.Rows.Count + 1);
                    }
                    for (int i = 0; i < dot.Rows.Count; i++)
                    {
                        DataRow dor = dot.Rows[i];
                        dgvOther.Rows[i].Cells["toll_id"].Value    = CommonCtrl.IsNullToString(dor["toll_id"]);
                        dgvOther.Rows[i].Cells["Osum_money"].Value = ControlsConfig.SetNewValue(CommonCtrl.IsNullToString(dor["sum_money"]), 2);
                        dgvOther.Rows[i].Cells["Oremarks"].Value   = CommonCtrl.IsNullToString(dor["remarks"]);
                        dgvOther.Rows[i].Cells["cost_types"].Value = GetDicName(CommonCtrl.IsNullToString(dor["cost_types"]));
                    }
                }

                #endregion

                #region 附件信息数据
                //附件信息数据
                ucAttr.TableName         = "tb_maintain_info";
                ucAttr.TableNameKeyValue = strRepairId;
                ucAttr.BindAttachment();
                #endregion
                #endregion
            }
        }
Пример #33
0
        public void LoadSettings()
        {
            //读取配置XML文件来初始化界面信息
            XmlDocument xmlDocument = new XmlDocument();
            var         path        = App.LocalRPAStudioDir + @"\Config\RPARobot.settings";

            xmlDocument.Load(path);
            var rootNode            = xmlDocument.DocumentElement;
            var userSettingsElement = rootNode.SelectSingleNode("UserSettings") as XmlElement;

            //根据自启动项设置IsAutoRun值
            var isAutoRunElement = userSettingsElement.SelectSingleNode("IsAutoRun") as XmlElement;

            if (isAutoRunElement.InnerText.ToLower().Trim() == "true")
            {
                //注册表设置自启动
                Common.SetAutoRun(true);
                IsAutoRun = true;
            }
            else
            {
                ////注册表取消自启动
                Common.SetAutoRun(false);
                IsAutoRun = false;
            }

            //根据配置XML信息设置IsAutoOpenMainWindow
            var isAutoOpenMainWindowElement = userSettingsElement.SelectSingleNode("IsAutoOpenMainWindow") as XmlElement;

            if (isAutoOpenMainWindowElement.InnerText.ToLower().Trim() == "true")
            {
                IsAutoOpenMainWindow = true;
            }
            else
            {
                IsAutoOpenMainWindow = false;
            }

            if ((userSettingsElement.SelectSingleNode("IsEnableScreenRecorder") as XmlElement)?.InnerText.ToLower().Trim() == "true")
            {
                IsEnableScreenRecorder = true;
            }
            else
            {
                IsEnableScreenRecorder = false;
            }
            XmlElement fpsElement     = userSettingsElement.SelectSingleNode("FPS") as XmlElement;
            XmlElement qualityElement = userSettingsElement.SelectSingleNode("Quality") as XmlElement;

            if (int.TryParse(fpsElement?.InnerText.Trim(), out var fps))
            {
                FPS = fps;
            }
            if (int.TryParse(qualityElement?.InnerText.Trim(), out var quality))
            {
                Quality = quality;
            }
            //if ((userSettingsElement.SelectSingleNode("IsEnableControlServer") as XmlElement).InnerText.ToLower().Trim() == "true")
            //{
            //    this.IsEnableControlServer = true;
            //}
            //else
            //{
            //    this.IsEnableControlServer = false;
            //}
            //XmlElement xmlElement4 = userSettingsElement.SelectSingleNode("ControlServerUri") as XmlElement;
            //this.ControlServerUri = xmlElement4.InnerText.Trim();
        }
Пример #34
0
        private void BtnTrack_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtTrackingNumber.Text))
            {
                MessageBox.Show("Please enter a tracking number.");
                return;
            }

            // We rely on AWB numbers being exactly 10 digits, trim the field.
            txtTrackingNumber.Text = txtTrackingNumber.Text.Trim();

#pragma warning disable IDE0017 // Simplify object initialization
            try
            {
                this.Enabled = false;

                pubTrackingRequest reqData = new pubTrackingRequest();

                reqData.TrackingRequest = new TrackingRequest();


                reqData.TrackingRequest.Request = new Request();
#pragma warning restore IDE0017 // Simplify object initialization
                reqData.TrackingRequest.Request.ServiceHeader = new ServiceHeader
                {
                    MessageReference = Guid.NewGuid().ToString("N"), // = DateTime.Now.Ticks.ToString();
                    MessageTime      = DateTime.Now
                };

                if (10 == txtTrackingNumber.Text.Length)
                {
                    reqData.TrackingRequest.AWBNumber = new[] { txtTrackingNumber.Text.Trim() };
                }
                else
                {
                    reqData.TrackingRequest.LPNumber = new[] { txtTrackingNumber.Text.Trim() };
                }

                reqData.TrackingRequest.LevelOfDetails = LevelOfDetails.ALL_CHECK_POINTS;

                reqData.TrackingRequest.PiecesEnabled = "B";

                reqData.TrackingRequest.EstimatedDeliveryDateEnabled          = true;
                reqData.TrackingRequest.EstimatedDeliveryDateEnabledSpecified = true;

                GloWS_Request = Common.XMLToString(reqData.GetType(), reqData);

                var glowsAuthData = Common.PrepareGlowsAuth("glDHLExpressTrack");

                gblDHLExpressTrackClient client = new gblDHLExpressTrackClient(new CustomBinding(glowsAuthData.Item2), glowsAuthData.Item1);
                client.ClientCredentials.UserName.UserName = glowsAuthData.Item3;
                client.ClientCredentials.UserName.Password = glowsAuthData.Item4;

                pubTrackingResponse resp;

                try
                {
                    resp = client.trackShipmentRequest(reqData);
                }
                catch (Exception ex)
                {
                    var text = ex.Message;
                    label1.Text = label1.Text + ".";
                    return;
                }

                //pubTrackingResponse resp = req.trackShipmentRequest(reqData);

                if (null != resp.TrackingResponse.Fault)
                {
                    MessageBox.Show("There was an error in tracking.");
                    return;
                }

                GloWS_Response = Common.XMLToString(resp.GetType(), resp);

                // Get the most recent AWB Info (this is a common issue due to AWB reuse)
                AWBInfo shipment = resp.TrackingResponse.AWBInfo.Aggregate((a1, a2) => a1.ShipmentInfo.ShipmentDate > a2.ShipmentInfo.ShipmentDate ? a1 : a2);

                if (string.IsNullOrWhiteSpace(shipment.AWBNumber) ||
                    "No Shipments Found" == shipment.Status.ActionStatus)
                {
                    MessageBox.Show("No shipment found with that AWB number");
                    return;
                }

                SetTextboxText(ref txtShipper, shipment.ShipmentInfo.ShipperName);
                SetTextboxText(ref txtConsignee, shipment.ShipmentInfo.ConsigneeName);
                SetTextboxText(ref txtShipmentDate, shipment.ShipmentInfo.ShipmentDate);
                SetTextboxText(ref txtNumberOfPieces, shipment.ShipmentInfo.Pieces);
                SetTextboxText(ref txtShipmentWeight, shipment.ShipmentInfo.Weight, true, shipment.ShipmentInfo.WeightUnitSpecified, shipment.ShipmentInfo.WeightUnit);
                if (null != shipment.ShipmentInfo.ShipperReference)
                {
                    SetTextboxText(ref txtShipmentReference, shipment.ShipmentInfo.ShipperReference.ReferenceID);
                }
                List <string> lastCheckpoints = new List <string>();
                foreach (PieceInfo piece in shipment.Pieces.PieceInfo)
                {
                    if (piece.PieceEvent.Any())
                    {
                        var lastCheckpoint = piece.PieceEvent.Aggregate((p1, p2) => p1.Date > p2.Date ? p1 : p2).ServiceEvent.EventCode;
                        lastCheckpoints.Add(lastCheckpoint);
                    }
                    else
                    {
                        lastCheckpoints.Add("NONE");
                    }
                }

                SetTextboxText(ref txtShipmentLastCheckpoint, string.Join(" | ", lastCheckpoints));

                // Set up our tracking data list for display
                List <TrackingEventData> eventData = new List <TrackingEventData>();

                if (null != shipment.ShipmentInfo.ShipmentEvent)
                {
                    List <TrackingEventData> shipmentEvents = new List <TrackingEventData>();
                    foreach (ShipmentEvent shipmentEvent in shipment.ShipmentInfo.ShipmentEvent)
                    {
                        shipmentEvents.Add(new TrackingEventData(shipment.AWBNumber, shipmentEvent));
                    }
                    shipmentEvents.Sort((x, y) => x.Date.CompareTo(y.Date));
                    eventData.AddRange(shipmentEvents);
                }

                if (null != shipment.Pieces.PieceInfo)
                {
                    List <TrackingEventData> pieceEvents;
                    foreach (PieceInfo piece in shipment.Pieces.PieceInfo)
                    {
                        if (null != piece.PieceEvent)
                        {
                            pieceEvents = new List <TrackingEventData>();
                            foreach (PieceEvent pieceEvent in piece.PieceEvent)
                            {
                                pieceEvents.Add(new TrackingEventData(piece.PieceDetails.LicensePlate, pieceEvent));
                            }
                            pieceEvents.Sort((x, y) => x.Date.CompareTo(y.Date));
                            eventData.AddRange(pieceEvents);
                        }
                    }
                }

                dgvTrackingData.DataSource = eventData;

                dgvTrackingData.RowHeadersVisible        = false;
                dgvTrackingData.AllowUserToOrderColumns  = true;
                dgvTrackingData.AllowUserToResizeColumns = true;
                dgvTrackingData.AllowUserToResizeRows    = false;

                // Set the column order(s)
                dgvTrackingData.Columns["Date"].DisplayIndex            = 0;
                dgvTrackingData.Columns["TrackingNumber"].DisplayIndex  = 1;
                dgvTrackingData.Columns["Code"].DisplayIndex            = 2;
                dgvTrackingData.Columns["Description"].DisplayIndex     = 3;
                dgvTrackingData.Columns["ServiceAreaCode"].DisplayIndex = 4;
                dgvTrackingData.Columns["ServiceAreaName"].DisplayIndex = 5;

                // Set the column headers(s)
                dgvTrackingData.Columns["TrackingNumber"].HeaderText  = "AWB / LPN";
                dgvTrackingData.Columns["ServiceAreaCode"].HeaderText = "S.A.";
                dgvTrackingData.Columns["ServiceAreaName"].HeaderText = "S.A. Name";

                foreach (DataGridViewColumn col in dgvTrackingData.Columns)
                {
                    col.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                }

                dgvTrackingData.Refresh();
                dgvTrackingData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            }
            finally
            {
                this.Enabled = true;
            }
        }
Пример #35
0
    protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
    {
        if (e.CommandName == "alpha" || e.CommandName == "NoFilter")
        {
            String value = null;
            switch (e.CommandName)
            {
            case ("alpha"):
            {
                value = string.Format("{0}%", e.CommandArgument);
                break;
            }

            case ("NoFilter"):
            {
                value = "%";
                break;
            }
            }
            ObjectDataSource1.SelectParameters["CompanyName"].DefaultValue = value;
            ObjectDataSource1.DataBind();
            RadGrid1.Rebind();
        }
        else if (e.CommandName == "QuickUpdate")
        {
            string AdsBannerID, Priority, IsAvailable;
            var    oAdsBanner = new AdsBanner();

            foreach (GridDataItem item in RadGrid1.Items)
            {
                AdsBannerID = item.GetDataKeyValue("AdsBannerID").ToString();
                Priority    = ((RadNumericTextBox)item.FindControl("txtPriority")).Text.Trim();
                IsAvailable = ((CheckBox)item.FindControl("chkIsAvailable")).Checked.ToString();

                oAdsBanner.AdsBannerQuickUpdate(
                    AdsBannerID,
                    Priority,
                    IsAvailable
                    );
            }
        }
        else if (e.CommandName == "DeleteSelected")
        {
            var oAdsBanner = new AdsBanner();

            foreach (GridDataItem item in RadGrid1.SelectedItems)
            {
                string strFileName = ((HiddenField)item.FindControl("hdnFileName")).Value;

                if (!string.IsNullOrEmpty(strFileName))
                {
                    string strSavePath = Server.MapPath("~/res/advertisement/" + strFileName);
                    if (File.Exists(strSavePath))
                    {
                        File.Delete(strSavePath);
                    }
                }
            }
        }
        else if (e.CommandName == "PerformInsert" || e.CommandName == "Update")
        {
            var command      = e.CommandName;
            var row          = command == "PerformInsert" ? (GridEditFormInsertItem)e.Item : (GridEditFormItem)e.Item;
            var FileFileName = (RadUpload)row.FindControl("FileFileName");
            var dpFromDate   = (RadDatePicker)row.FindControl("dpFromDate");
            var dpToDate     = (RadDatePicker)row.FindControl("dpToDate");

            string strCompanyName = HttpUtility.HtmlDecode(FCKEditorFix.Fix(((RadEditor)row.FindControl("txtCompanyName")).Content.Trim()));//((TextBox)row.FindControl("txtCompanyName")).Text.Trim();
            //string strTitle = ((TextBox)row.FindControl("txtTitle")).Text.Trim();
            //string strDescription = ((TextBox)row.FindControl("txtDescription")).Text.Trim();
            string strConvertedAdsBannerName = Common.ConvertTitle(strCompanyName);
            string strFileName      = FileFileName.UploadedFiles.Count > 0 ? FileFileName.UploadedFiles[0].GetName() : "";
            string strIsAvailable   = ((CheckBox)row.FindControl("chkIsAvailable")).Checked.ToString();
            string strPriority      = ((RadNumericTextBox)row.FindControl("txtPriority")).Text.Trim();
            string strFromDate      = dpFromDate.SelectedDate.HasValue ? dpFromDate.SelectedDate.Value.ToString("MM/dd/yyyy") : "";
            string strToDate        = dpToDate.SelectedDate.HasValue ? dpToDate.SelectedDate.Value.ToString("MM/dd/yyyy") : "";
            string strAdsCategoryID = "11";// ((RadComboBox)row.FindControl("ddlCategory")).SelectedValue;
            string strWebsite       = ((TextBox)row.FindControl("txtWebsite")).Text.Trim();
            double ratio            = 0;

            if (!string.IsNullOrEmpty(strFileName))
            {
                string strTempPath = Server.MapPath(FileFileName.TargetFolder + strFileName);
                if (IsImageFormat(strFileName))
                {
                    System.Drawing.Image img = System.Drawing.Image.FromFile(strTempPath);
                    ratio = (double)img.Width / (img.Height == 0 ? 1 : img.Height);
                    img.Dispose();
                }
                else
                {
                    SwfParser swfParser = new SwfParser();
                    Rectangle rectangle = swfParser.GetDimensions(strTempPath);
                    ratio = (double)rectangle.Width / (rectangle.Height == 0 ? 1 : rectangle.Height);
                }
                string[] files = Directory.GetFiles(Server.MapPath(FileFileName.TargetFolder));

                foreach (string filePath in files)
                {
                    File.Delete(filePath);
                }
            }

            var oAdsBanner = new AdsBanner();

            if (e.CommandName == "PerformInsert")
            {
                strFileName = oAdsBanner.AdsBannerInsert(
                    strFileName,
                    strConvertedAdsBannerName,
                    strAdsCategoryID,
                    strCompanyName,
                    strWebsite,
                    strFromDate,
                    strToDate,
                    strPriority,
                    strIsAvailable,
                    ratio == 0 ? "" : ratio.ToString().Replace(',', '.')
                    );

                string strFullPath = "~/res/advertisement/" + strFileName;

                if (!string.IsNullOrEmpty(strFileName))
                {
                    FileFileName.UploadedFiles[0].SaveAs(Server.MapPath(strFullPath));
                    if (IsImageFormat(strFileName))
                    {
                        //ResizeCropImage.ResizeByCondition(strFullPath, 800, 800);
                    }
                }
                RadGrid1.Rebind();
            }
            else
            {
                var dsUpdateParam   = ObjectDataSource1.UpdateParameters;
                var strAdsBannerID  = row.GetDataKeyValue("AdsBannerID").ToString();
                var strOldFileName  = ((HiddenField)row.FindControl("hdnFileName")).Value;
                var strOldImagePath = Server.MapPath("~/res/advertisement/" + strOldFileName);

                dsUpdateParam["FileName"].DefaultValue = strFileName;
                dsUpdateParam["ConvertedAdsBannerName"].DefaultValue = strConvertedAdsBannerName;
                dsUpdateParam["AdsCategoryID"].DefaultValue          = strAdsCategoryID;
                dsUpdateParam["FromDate"].DefaultValue    = strFromDate;
                dsUpdateParam["ToDate"].DefaultValue      = strToDate;
                dsUpdateParam["IsAvailable"].DefaultValue = strIsAvailable;
                dsUpdateParam["Ratio"].DefaultValue       = ratio == 0 ? "" : ratio.ToString().Replace(',', '.');

                if (!string.IsNullOrEmpty(strFileName))
                {
                    var strFullPath = "~/res/advertisement/" + (string.IsNullOrEmpty(strConvertedAdsBannerName) ? "" : strConvertedAdsBannerName + "-") + strAdsBannerID + strFileName.Substring(strFileName.LastIndexOf('.'));

                    if (File.Exists(strOldImagePath))
                    {
                        File.Delete(strOldImagePath);
                    }

                    FileFileName.UploadedFiles[0].SaveAs(Server.MapPath(strFullPath));
                    if (IsImageFormat(strFileName))
                    {
                        //ResizeCropImage.ResizeByCondition(strFullPath, 654, 654);
                    }
                }
            }
        }
        if (e.CommandName == "DeleteImage")
        {
            var oAdsBanner     = new AdsBanner();
            var lnkDeleteImage = (LinkButton)e.CommandSource;
            var s = lnkDeleteImage.Attributes["rel"].ToString().Split('#');
            var strAdsBannerID = s[0];
            var strFileName    = s[1];

            oAdsBanner.AdsBannerDelete(strAdsBannerID);
            DeleteImage(strFileName);
            RadGrid1.Rebind();
        }
    }
Пример #36
0
 /// <summarY>
 /// Returns angle between points in Degrees
 /// </summarY>
 /// <param name="point1"></param>
 /// <param name="point2"></param>
 /// <returns></returns>
 public static float AngleBetweenPoints(Vector2 point1, Vector2 point2)
 {
     return(Common.Deg2Rad((float)Math.Atan2(point1.Y - point2.Y, point1.X - point2.X)));
 }
Пример #37
0
        void BindData()
        {
            string filed   = @"sup_code,sup_full_name,期初应付款,sum(本期发生) 本期增加应付款,SUM(其中商业折扣) 其中商业折扣,SUM(本期付款) 本期承收应付款,
SUM(其中现金折扣) 其中现金折扣,isnull(期初应付款,0)+sum(isnull(本期发生,0))-SUM(isnull(本期付款,0)) 期末结存应付额";
            string table   = string.Format(@"(
select c.sup_code,c.sup_full_name,d.期初应付款,a.本期发生,a.其中商业折扣,a.本期付款,a.其中现金折扣,a.单据日期,c.sup_type
from v_payable_document a 
left join tb_supplier c on a.sup_id=c.sup_id
left join (
select sup_id,SUM(isnull(本期发生,0)-isnull(本期付款,0)) 期初应付款 from v_payable_document where 单据日期<{0}
group by sup_id
) d on a.sup_id=d.sup_id
where a.单据日期 between {0} and {1}
) a ", Common.LocalDateTimeToUtcLong(Convert.ToDateTime(dicreate_time.StartDate).Date), Common.LocalDateTimeToUtcLong(Convert.ToDateTime(dicreate_time.EndDate).Date.AddDays(1).AddMilliseconds(-1)));
            string groupBy = "group by sup_code,sup_full_name,期初应付款";

            string where = GetWhere();
            dt           = DBHelper.GetTable("", table, filed, where, "", groupBy);
            //dt.DataTableToDate("order_date");
            dt.DataTableSum(null);
            dgvReport.DataSource = dt;
        }
Пример #38
0
 public string ToString(bool value)
 {
     return(value
         ? Common.GetEnumDescription(ActionSelectorOperand.Set)
         : Common.GetEnumDescription(ActionSelectorOperand.NotSet));
 }
Пример #39
0
        private void BUT_writePIDS_Click(object sender, EventArgs e)
        {
            if (Common.MessageShowAgain("Write Raw Params", "Are you Sure?") != DialogResult.OK)
            {
                return;
            }

            // sort with enable at the bottom - this ensures params are set before the function is disabled
            var temp = _changes.Keys.Cast <string>().ToList();

            temp.SortENABLE();

            bool enable = temp.Any(a => a.EndsWith("_ENABLE"));

            if (enable)
            {
                CustomMessageBox.Show(
                    "You have changed an Enable parameter. You may need to do a full param refresh to show all params",
                    "Params");
            }

            int error = 0;

            foreach (string value in temp)
            {
                try
                {
                    if (MainV2.comPort.BaseStream == null || !MainV2.comPort.BaseStream.IsOpen)
                    {
                        CustomMessageBox.Show("Your are not connected", Strings.ERROR);
                        return;
                    }

                    MainV2.comPort.setParam(value, (float)_changes[value]);

                    try
                    {
                        // set control as well
                        var textControls = Controls.Find(value, true);
                        if (textControls.Length > 0)
                        {
                            ThemeManager.ApplyThemeTo(textControls[0]);
                        }
                    }
                    catch
                    {
                    }

                    try
                    {
                        // set param table as well
                        foreach (DataGridViewRow row in Params.Rows)
                        {
                            if (row.Cells[0].Value.ToString() == value)
                            {
                                row.Cells[1].Style.BackColor = ThemeManager.ControlBGColor;
                                _changes.Remove(value);
                                break;
                            }
                        }
                    }
                    catch
                    {
                    }
                }
                catch
                {
                    error++;
                    CustomMessageBox.Show("Set " + value + " Failed");
                }
            }

            if (error > 0)
            {
                CustomMessageBox.Show("Not all parameters successfully saved.", "Saved");
            }
            else
            {
                CustomMessageBox.Show("Parameters successfully saved.", "Saved");
            }
        }
Пример #40
0
        ///<summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void UCRoleAddOrEdit_SaveEvent(object sender, EventArgs e)
        {
            this.errorProvider1.Clear();
            string msg = "";
            bool   bln = Validator(ref msg);

            if (!bln)
            {
                return;
            }
            string newGuid;
            string currRole_id = "";

            string keyName  = string.Empty;
            string keyValue = string.Empty;
            string opName   = "新增角色管理";
            Dictionary <string, string> dicFileds = new Dictionary <string, string>();

            dicFileds.Add("Role_name", txtRole_name.Caption.Trim()); //角色全名
            dicFileds.Add("remark", txtremark.Caption.Trim());       //备注


            string nowUtcTicks = Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString();

            dicFileds.Add("update_by", HXCPcClient.GlobalStaticObj.UserID);
            dicFileds.Add("update_time", nowUtcTicks);

            if (wStatus == WindowStatus.Add || wStatus == WindowStatus.Copy)
            {
                string strcode = CommonUtility.GetNewNo(SYSModel.DataSources.EnumProjectType.Role);
                dicFileds.Add("Role_code", strcode);//角色编码
                //txtRole_code.Caption = strcode;

                newGuid     = Guid.NewGuid().ToString();
                currRole_id = newGuid;
                dicFileds.Add("role_id", newGuid);//新ID
                dicFileds.Add("create_by", HXCPcClient.GlobalStaticObj.UserID);
                dicFileds.Add("create_time", nowUtcTicks);

                dicFileds.Add("state", Convert.ToInt16(SYSModel.DataSources.EnumStatus.Start).ToString());                 //启用
                dicFileds.Add("data_sources", Convert.ToInt16(SYSModel.DataSources.EnumDataSources.SELFBUILD).ToString()); //来源 自建
                dicFileds.Add("enable_flag", "1");


                bln = DBHelper.Submit_AddOrEdit(opName, "sys_role", keyName, keyValue, dicFileds);
                if (bln)
                {
                    if (this.RefreshDataStart != null)
                    {
                        this.RefreshDataStart();
                    }

                    if (userIdList.Count > 0)
                    { //添加角色用户关系
                        bln = AddUserRole(newGuid, userIdList);
                    }
                    if (bln && dtFun.Rows.Count > 0)
                    {
                        //添加角色菜单权限
                        bln = addFunctionRole(newGuid, dtFun);
                    }
                }
            }
            else if (wStatus == WindowStatus.Edit)
            {
                keyName     = "role_id";
                keyValue    = id;
                currRole_id = id;
                opName      = "编辑用户角色关系";
                bln         = DBHelper.Submit_AddOrEdit(opName, "sys_role", keyName, keyValue, dicFileds);
                if (bln)
                {
                    if (this.RefreshDataStart != null)
                    {
                        this.RefreshDataStart();
                    }

                    if (iUserRoleCount == 0)
                    {
                        if (userIdList.Count > 0)
                        {
                            bln = AddUserRole(id, userIdList);
                        }
                    }
                    else
                    {
                        if (userIdList.Count > 0)
                        {
                            bln = UpdateUserRole(id, userIdList);
                        }
                        else
                        {
                            bln = DeleteUserRole(id);
                        }
                    }
                    if (bln)
                    {
                        if (funIdList.Count > 0)
                        {
                            bln = DeleteFunRole(id, funIdList);
                        }
                        if (dtFun.Rows.Count > 0)
                        {
                            //添加角色菜单权限
                            bln = addFunctionRole(id, dtFun);
                        }
                    }
                }
                iUserRoleCount = dgvUser.Rows.Count;
            }
            if (bln)
            {
                MessageBoxEx.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);
                //uc.BindPageData();//.SaveAfter(currRole_id);
            }
            else
            {
                MessageBoxEx.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        public void MSOXWSFOLD_S06_TC01_UpdateFolder()
        {
            #region Create a new folder in the inbox folder.

            // CreateFolder request.
            CreateFolderType createFolderRequest = this.GetCreateFolderRequest(DistinguishedFolderIdNameType.inbox.ToString(), new string[] { "Custom Folder" }, new string[] { "IPF.MyCustomFolderClass" }, null);

            // Create a new folder.
            CreateFolderResponseType createFolderResponse = this.FOLDAdapter.CreateFolder(createFolderRequest);
            FolderIdType             folderId             = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId;

            // Check the response.
            Common.CheckOperationSuccess(createFolderResponse, 1, this.Site);

            // Save the new created folder's folder id.
            this.NewCreatedFolderIds.Add(folderId);

            #endregion

            #region Update Folder Operation.

            // UpdateFolder request.
            UpdateFolderType updateFolderRequest = this.GetUpdateFolderRequest("Folder", "SetFolderField", folderId);

            // Update the specific folder's properties.
            UpdateFolderResponseType updateFolderResponse = this.FOLDAdapter.UpdateFolder(updateFolderRequest);

            // Check the response.
            Common.CheckOperationSuccess(updateFolderResponse, 1, this.Site);

            string updateNameInRequest = ((SetFolderFieldType)updateFolderRequest.FolderChanges[0].Updates[0]).Item1.DisplayName;
            #endregion

            #region Get the updated folder.

            // GetFolder request.
            GetFolderType getUpdatedFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, folderId);

            // Get the updated folder.
            GetFolderResponseType getFolderResponse = this.FOLDAdapter.GetFolder(getUpdatedFolderRequest);

            // Check the response.
            Common.CheckOperationSuccess(getFolderResponse, 1, this.Site);

            FolderInfoResponseMessageType allFolders = (FolderInfoResponseMessageType)getFolderResponse.ResponseMessages.Items[0];
            FolderType gotFolderInfo = (FolderType)allFolders.Folders[0];

            #endregion

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R46444");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R46444
            this.Site.CaptureRequirementIfAreEqual <ResponseClassType>(
                ResponseClassType.Success,
                updateFolderResponse.ResponseMessages.Items[0].ResponseClass,
                46444,
                @"[In UpdateFolder Operation]A successful UpdateFolder operation request returns an UpdateFolderResponse element with the ResponseClass attribute of the UpdateFolderResponseMessage element set to ""Success"".");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R4644");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R4644
            this.Site.CaptureRequirementIfAreEqual <ResponseCodeType>(
                ResponseCodeType.NoError,
                updateFolderResponse.ResponseMessages.Items[0].ResponseCode,
                4644,
                @"[In UpdateFolder Operation]A successful UpdateFolder operation request returns an UpdateFolderResponse element with the ResponseCode element of the UpdateFolderResponse element set to ""NoError"".");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R8902");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R8902
            this.Site.CaptureRequirementIfAreEqual <ResponseClassType>(
                ResponseClassType.Success,
                updateFolderResponse.ResponseMessages.Items[0].ResponseClass,
                8902,
                @"[In t:FolderChangeType Complex Type]FolderId specifies the folder identifier and change key.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R582");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R582
            this.Site.CaptureRequirementIfAreEqual <ResponseClassType>(
                ResponseClassType.Success,
                updateFolderResponse.ResponseMessages.Items[0].ResponseClass,
                582,
                @"[In m:UpdateFolderType Complex Type]The UpdateFolderType complex type specifies a request message to update folders in a mailbox. ");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R534");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R534
            // Set a property on a FolderType folder successfully, indicates that Folder represents a regular folder.
            this.Site.CaptureRequirementIfAreEqual <ResponseClassType>(
                ResponseClassType.Success,
                updateFolderResponse.ResponseMessages.Items[0].ResponseClass,
                534,
                @"[In t:SetFolderFieldType Complex Type]Folder represents a regular folder in the server database.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R9301");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R9301
            this.Site.CaptureRequirementIfAreEqual <string>(
                updateNameInRequest,
                gotFolderInfo.DisplayName,
                9301,
                @"[In t:FolderChangeType Complex Type][Updates] Specifies a collection of changes to a folder.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R546");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R546
            this.Site.CaptureRequirementIfAreEqual <string>(
                updateNameInRequest,
                gotFolderInfo.DisplayName,
                546,
                @"[In t:FolderChangeType Complex Type]The FolderChangeType complex type specifies a collection of changes to be performed on a single folder.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R5051");

            // All folders updated successfully!
            this.Site.CaptureRequirement(
                5051,
                @"[In m:UpdateFolderType Complex Type]FolderChanges represents an array of folders to be updated.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R531");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R531
            this.Site.CaptureRequirementIfAreEqual <string>(
                updateNameInRequest,
                gotFolderInfo.DisplayName,
                531,
                @"[In t:NonEmptyArrayOfFolderChangesType Complex Type]FolderChange represents a collection of changes to be performed on a single folder.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R5251");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R5251
            this.Site.CaptureRequirementIfAreEqual <string>(
                updateNameInRequest,
                gotFolderInfo.DisplayName,
                5251,
                @"[In t:NonEmptyArrayOfFolderChangeDescriptionsType Complex Type]SetFolderField represents an UpdateFolder operation to set a property on an existing folder.");
        }
Пример #42
0
 public override string ToString()
 {
     return(IsSet
         ? Common.GetEnumDescription(ActionSelectorOperand.Set)
         : Common.GetEnumDescription(ActionSelectorOperand.NotSet));
 }
        public void MSOXWSFOLD_S06_TC03_UpdateMultipleFolders()
        {
            #region Create a new folder in the inbox folder.

            // CreateFolder request.
            CreateFolderType createFolderRequest = this.GetCreateFolderRequest(
                DistinguishedFolderIdNameType.inbox.ToString(),
                new string[] { "Custom Folder1", "Custom Folder2", "Custom Folder3", "Custom Folder4" },
                new string[] { "IPF.Appointment", "IPF.Contact", "IPF.Task", "IPF.Search" },
                null);

            // Create a new folder.
            CreateFolderResponseType createFolderResponse = this.FOLDAdapter.CreateFolder(createFolderRequest);

            // Check the response.
            Common.CheckOperationSuccess(createFolderResponse, 4, this.Site);

            FolderIdType folderId1 = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId;
            FolderIdType folderId2 = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[1]).Folders[0].FolderId;
            FolderIdType folderId3 = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[2]).Folders[0].FolderId;
            FolderIdType folderId4 = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[3]).Folders[0].FolderId;

            // Save the new created folder's folder id.
            this.NewCreatedFolderIds.Add(folderId1);
            this.NewCreatedFolderIds.Add(folderId2);
            this.NewCreatedFolderIds.Add(folderId3);
            this.NewCreatedFolderIds.Add(folderId4);

            #endregion

            #region Update Folder Operation.

            // UpdateFolder request.
            UpdateFolderType updateFolderRequest = this.GetUpdateFolderRequest(
                new string[] { "CalendarFolder", "ContactsFolder", "TasksFolder", "SearchFolder" },
                new string[] { "SetFolderField", "SetFolderField", "SetFolderField", "SetFolderField" },
                new FolderIdType[] { folderId1, folderId2, folderId3, folderId4 });

            // Update the specific folder's properties.
            UpdateFolderResponseType updateFolderResponse = this.FOLDAdapter.UpdateFolder(updateFolderRequest);

            // Check the response.
            Common.CheckOperationSuccess(updateFolderResponse, 4, this.Site);

            #endregion

            #region Get the updated folder.

            // GetFolder request.
            GetFolderType getUpdatedFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, folderId1, folderId2, folderId3, folderId4);

            // Get the updated folder.
            GetFolderResponseType getFolderResponse = this.FOLDAdapter.GetFolder(getUpdatedFolderRequest);

            // Check the response.
            Common.CheckOperationSuccess(getFolderResponse, 4, this.Site);

            FolderInfoResponseMessageType allPropertyOfSearchFolder = (FolderInfoResponseMessageType)getFolderResponse.ResponseMessages.Items[3];

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R33");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R33
            this.Site.CaptureRequirementIfIsInstanceOfType(
                allPropertyOfSearchFolder.Folders[0],
                typeof(SearchFolderType),
                33,
                @"[In t:ArrayOfFoldersType Complex Type]The type of element SearchFolder is t:SearchFolderType ([MS-OXWSSRCH] section 2.2.3.26).");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R3302");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R3302
            this.Site.CaptureRequirementIfIsInstanceOfType(
                allPropertyOfSearchFolder.Folders[0],
                typeof(SearchFolderType),
                3302,
                @"[In t:ArrayOfFoldersType Complex Type]SearchFolder represents a search folder that is contained in a mailbox.");

            #endregion

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R536");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R536
            // Set a property on a CalendarFolderType folder successfully, indicates that Folder represents a regular folder.
            this.Site.CaptureRequirementIfAreEqual <ResponseClassType>(
                ResponseClassType.Success,
                updateFolderResponse.ResponseMessages.Items[0].ResponseClass,
                536,
                @"[In t:SetFolderFieldType Complex Type]CalendarFolder represents a folder that primarily contains calendar items. ");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R538");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R538
            // Set a property on a ContactFolderType folder successfully, indicates that Folder represents a regular folder.
            this.Site.CaptureRequirementIfAreEqual <ResponseClassType>(
                ResponseClassType.Success,
                updateFolderResponse.ResponseMessages.Items[1].ResponseClass,
                538,
                @"[In t:SetFolderFieldType Complex Type]ContactsFolder represents a Contacts folder in a mailbox. ");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R542");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R542
            // Set a property on a TaskFolderType folder successfully, indicates that Folder represents a regular folder.
            this.Site.CaptureRequirementIfAreEqual <ResponseClassType>(
                ResponseClassType.Success,
                updateFolderResponse.ResponseMessages.Items[2].ResponseClass,
                542,
                @"[In t:SetFolderFieldType Complex Type]TasksFolder represents a Tasks folder that is contained in a mailbox. ");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R540");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R540
            // Set a property on a SearchFolderType folder successfully, indicates that Folder represents a regular folder.
            this.Site.CaptureRequirementIfAreEqual <ResponseClassType>(
                ResponseClassType.Success,
                updateFolderResponse.ResponseMessages.Items[3].ResponseClass,
                540,
                @"[In t:SetFolderFieldType Complex Type]SearchFolder represents a search folder that is contained in a mailbox. ");
        }
        public void MSOXWSFOLD_S06_TC05_UpdateFolderWithMultipleProperties()
        {
            #region Create a new folder in the inbox folder.

            // CreateFolder request.
            CreateFolderType createFolderRequest = this.GetCreateFolderRequest(DistinguishedFolderIdNameType.inbox.ToString(), new string[] { "Custom Folder" }, new string[] { "IPF.MyCustomFolderClass" }, null);

            // Create a new folder.
            CreateFolderResponseType createFolderResponse = this.FOLDAdapter.CreateFolder(createFolderRequest);
            FolderIdType             folderId             = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId;

            // Check the response.
            Common.CheckOperationSuccess(createFolderResponse, 1, this.Site);

            // Save the new created folder's folder id.
            this.NewCreatedFolderIds.Add(folderId);

            #endregion

            #region Update Folder Operation.

            // UpdateFolder request.
            UpdateFolderType updateFolderRequest = this.GetUpdateFolderRequest("Folder", "SetFolderField", folderId);

            // In order to verify MS-OXWSCDATA_R335, add another property(PermissionSet) into UpdateFolder request.
            FolderType updatingFolder = (FolderType)((SetFolderFieldType)updateFolderRequest.FolderChanges[0].Updates[0]).Item1;
            updatingFolder.PermissionSet                = new PermissionSetType();
            updatingFolder.PermissionSet.Permissions    = new PermissionType[1];
            updatingFolder.PermissionSet.Permissions[0] = new PermissionType();
            updatingFolder.PermissionSet.Permissions[0].CanCreateSubFolders          = true;
            updatingFolder.PermissionSet.Permissions[0].CanCreateSubFoldersSpecified = true;
            updatingFolder.PermissionSet.Permissions[0].IsFolderOwner          = true;
            updatingFolder.PermissionSet.Permissions[0].IsFolderOwnerSpecified = true;
            updatingFolder.PermissionSet.Permissions[0].PermissionLevel        = new PermissionLevelType();
            updatingFolder.PermissionSet.Permissions[0].PermissionLevel        = PermissionLevelType.Custom;
            updatingFolder.PermissionSet.Permissions[0].UserId = new UserIdType();

            updatingFolder.PermissionSet.Permissions[0].UserId.PrimarySmtpAddress = Common.GetConfigurationPropertyValue("User2Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site);

            // Update the specific folder's properties.
            UpdateFolderResponseType updateFolderResponse = this.FOLDAdapter.UpdateFolder(updateFolderRequest);

            // Check the length.
            Site.Assert.AreEqual <int>(
                1,
                updateFolderResponse.ResponseMessages.Items.GetLength(0),
                "Expected Item Count: {0}, Actual Item Count: {1}",
                1,
                updateFolderResponse.ResponseMessages.Items.GetLength(0));

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R335");

            // Verify MS-OXWSCDATA requirement: MS-OXWSCDATA_R335
            this.Site.CaptureRequirementIfAreEqual <ResponseCodeType>(
                ResponseCodeType.ErrorIncorrectUpdatePropertyCount,
                updateFolderResponse.ResponseMessages.Items[0].ResponseCode,
                "MS-OXWSCDATA",
                335,
                @"[In m:ResponseCodeType Simple Type] The value ""ErrorIncorrectUpdatePropertyCount"" specifies that each change description in an UpdateItem or UpdateFolder method call MUST list only one property to be updated.");

            #endregion
        }
 public frmCS_LapChinhSachKM_ChonType()
 {
     InitializeComponent();
     Common.LoadStyle(this);
 }
        public void MSOXWSFOLD_S06_TC04_UpdateFolderWithDeleteFolderFieldType()
        {
            #region Create a new folder in the inbox folder

            // Configure permission set.
            PermissionSetType permissionSet = new PermissionSetType();
            permissionSet.Permissions    = new PermissionType[1];
            permissionSet.Permissions[0] = new PermissionType();
            permissionSet.Permissions[0].CanCreateSubFolders          = true;
            permissionSet.Permissions[0].CanCreateSubFoldersSpecified = true;
            permissionSet.Permissions[0].IsFolderOwner          = true;
            permissionSet.Permissions[0].IsFolderOwnerSpecified = true;
            permissionSet.Permissions[0].PermissionLevel        = new PermissionLevelType();
            permissionSet.Permissions[0].PermissionLevel        = PermissionLevelType.Custom;
            permissionSet.Permissions[0].UserId = new UserIdType();
            permissionSet.Permissions[0].UserId.PrimarySmtpAddress = Common.GetConfigurationPropertyValue("User2Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site);

            // CreateFolder request.
            CreateFolderType createFolderRequest = this.GetCreateFolderRequest(DistinguishedFolderIdNameType.inbox.ToString(), new string[] { "Custom Folder" }, new string[] { "IPF.MyCustomFolderClass" }, new PermissionSetType[] { permissionSet });

            // Create a new folder.
            CreateFolderResponseType createFolderResponse = this.FOLDAdapter.CreateFolder(createFolderRequest);

            // Check the response.
            Common.CheckOperationSuccess(createFolderResponse, 1, this.Site);

            // Save the new created folder's folder id.
            FolderIdType newFolderId = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId;
            this.NewCreatedFolderIds.Add(newFolderId);

            #endregion

            #region Update Folder Operation.

            // UpdateFolder request to delete folder permission value.
            UpdateFolderType updateFolderRequest = this.GetUpdateFolderRequest("Folder", "DeleteFolderField", newFolderId);

            // Update the specific folder's properties.
            UpdateFolderResponseType updateFolderResponse = this.FOLDAdapter.UpdateFolder(updateFolderRequest);

            // Check the response.
            Common.CheckOperationSuccess(updateFolderResponse, 1, this.Site);

            #endregion

            #region Switch user

            this.SwitchUser(Common.GetConfigurationPropertyValue("User2Name", this.Site), Common.GetConfigurationPropertyValue("User2Password", this.Site), Common.GetConfigurationPropertyValue("Domain", this.Site));

            #endregion

            #region Create a subfolder under the folder created in step 1 with User2's credential

            // CreateFolder request.
            CreateFolderType createFolderInSharedMailboxRequest = this.GetCreateFolderRequest(newFolderId.Id, new string[] { "Custom Folder" }, new string[] { "IPF.MyCustomFolderClass" }, null);

            // Create a new folder.
            CreateFolderResponseType createFolderInSharedMailboxResponse = this.FOLDAdapter.CreateFolder(createFolderInSharedMailboxRequest);

            // Check the length.
            Site.Assert.AreEqual <int>(
                1,
                createFolderInSharedMailboxResponse.ResponseMessages.Items.GetLength(0),
                "Expected Item Count: {0}, Actual Item Count: {1}",
                1,
                createFolderInSharedMailboxResponse.ResponseMessages.Items.GetLength(0));

            // Permission have been deleted so create operation should be failed.
            bool isPermissionDeleted = createFolderInSharedMailboxResponse.ResponseMessages.Items[0].ResponseClass.Equals(ResponseClassType.Error);

            #endregion

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R583");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R583
            // One permission set which set in CreateFolder is deleted when calling UpdateFolder.
            this.Site.CaptureRequirementIfIsTrue(
                isPermissionDeleted,
                583,
                @"[In t:DeleteFolderFieldType Complex Type]The DeleteFolderFieldType complex type represents an UpdateFolder operation to delete a property from a folder.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R5261");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R5261
            this.Site.CaptureRequirementIfIsTrue(
                isPermissionDeleted,
                5261,
                @"[In t:NonEmptyArrayOfFolderChangeDescriptionsType Complex Type]DeleteFolderField represents an UpdateFolder operation to delete a property from a folder.");
        }
Пример #47
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        op = Request.QueryString["op"];
        if (op == "edit")
        {
            int itemID = Common.StrToInt(hid_cid.Value, 0);
            SHUniversity.KPI.Model.KPIItems m = bll.GetModel(itemID, currUser.WorkID);
            if (m != null)
            {
                m.ItemLastUpdateDate = DateTime.Now;
                m.ItemUpdateUser     = currUser.WorkID;
                //何年月至何年月
                m.Int1 = int.Parse(ddl_pstartyear.SelectedValue);  //开始年
                m.Int2 = int.Parse(ddl_pstartmonth.SelectedValue); //开始月
                m.Int3 = int.Parse(ddl_pendyear.SelectedValue);    //End年
                m.Int4 = int.Parse(ddl_pendmonth.SelectedValue);   //End月

                m.ProjectNO   = txtProjectNO.Text.Trim();          //项目编号
                m.ProjectName = txtProjectName.Text.Trim();        //项目名称
                m.ProjectType = ddl_ptype.SelectedValue;           //项目类型

                m.Str5 = ddl_pc.SelectedValue;                     //类别

                decimal money = Common.StrToDecimal(txtGJJF.Text.Trim(), 0);
                if (money <= 0)
                {
                    Jscript.Alert("实到经费必须大于0");
                    return;
                }
                m.float1 = money;//实到经费
                //项目级别
                if (m.ProjectType == "F")
                {
                    if (money >= 800)
                    {
                        m.float2 = 5;//float2 F类 N 经费权重
                    }
                    if (500 <= money && money < 800)
                    {
                        m.float2 = 4.8M;
                    }
                    if (300 <= money && money < 500)
                    {
                        m.float2 = 4.6M;
                    }
                    if (200 <= money && money < 300)
                    {
                        m.float2 = 4.4M;
                    }
                    if (150 <= money && money < 200)
                    {
                        m.float2 = 4.2M;
                    }
                    if (100 <= money && money < 150)
                    {
                        m.float2 = 4M;
                    }
                    if (70 <= money && money < 100)
                    {
                        m.float2 = 3.6M;
                    }
                    if (50 <= money && money < 70)
                    {
                        m.float2 = 3M;
                    }
                    if (20 <= money && money < 50)
                    {
                        m.float2 = 2.4M;
                    }
                    if (money < 20)
                    {
                        m.float2 = 2M;
                    }
                }
                else
                {
                    if (m.ProjectType == "A")
                    {
                        m.float2 = 8;
                    }
                    if (m.ProjectType == "B")
                    {
                        m.float2 = 5;
                    }
                    if (m.ProjectType == "C")
                    {
                        m.float2 = 4;
                    }
                    if (m.ProjectType == "D")
                    {
                        m.float2 = 3;
                    }
                    if (m.ProjectType == "E")
                    {
                        m.float2 = 2;
                    }
                }


                m.float3 = Common.StrToDecimal(txt_self_lv.Text.Trim(), 0);//本人贡献比例
                if (m.float3 <= 0 || m.float3 >= 1)
                {
                    Jscript.Alert("本人贡献比例错误!数值范围0~1");
                }
                if (!string.IsNullOrEmpty(txtJS1.Text.Trim()))
                {
                    m.Str1   = txtJS1.Text.Trim();
                    m.float4 = Common.StrToDecimal(txt_js1_lv.Text.Trim(), 0);//教师一 贡献比例
                    if (m.float4 <= 0 || m.float4 > 1)
                    {
                        Jscript.Alert("教师1贡献比例错误!数值范围0~1");
                        return;
                    }
                }
                if (!string.IsNullOrEmpty(txtJS2.Text.Trim()))
                {
                    m.Str2   = txtJS2.Text.Trim();
                    m.float5 = Common.StrToDecimal(txt_js2_lv.Text.Trim(), 0);//教师2 贡献比例
                    if (m.float5 <= 0 || m.float5 > 1)
                    {
                        Jscript.Alert("教师2贡献比例错误!数值范围0~1");
                        return;
                    }
                }

                if (!string.IsNullOrEmpty(txtJS3.Text.Trim()))
                {
                    m.Str3   = txtJS3.Text.Trim();
                    m.float6 = Common.StrToDecimal(txt_js3_lv.Text.Trim(), 0);//教师3 贡献比例
                    if (m.float6 <= 0 || m.float6 > 1)
                    {
                        Jscript.Alert("教师3贡献比例错误!数值范围0~1");
                        return;
                    }
                }
                if (!string.IsNullOrEmpty(txtJS4.Text.Trim()))
                {
                    m.Str4   = txtJS4.Text.Trim();
                    m.float7 = Common.StrToDecimal(txt_js4_lv.Text.Trim(), 0);//教师4 贡献比例
                    if (m.float7 <= 0 || m.float7 > 1)
                    {
                        Jscript.Alert("教师4贡献比例错误!数值范围0~1");
                        return;
                    }
                }
                bool r = bll.Update(m, currUser.WorkID);
                if (r)
                {
                    Jscript.AlertAndRedirect("修改成功", "/KPIManage.aspx?id=" + TableID);
                }
                else
                {
                    Jscript.Alert("修改失败,请稍后再试");
                }
            }
        }
        else
        {
            SHUniversity.KPI.Model.KPIItems m = new SHUniversity.KPI.Model.KPIItems();
            //添加一个创新实验项目
            m.KPINO       = TableID;
            m.ItemType    = "教学改革";
            m.ItemCreator = currUser.WorkID;
            m.ItemDate    = DateTime.Now;
            //何年月至何年月
            m.Int1 = int.Parse(ddl_pstartyear.SelectedValue);  //开始年
            m.Int2 = int.Parse(ddl_pstartmonth.SelectedValue); //开始月
            m.Int3 = int.Parse(ddl_pendyear.SelectedValue);    //End年
            m.Int4 = int.Parse(ddl_pendmonth.SelectedValue);   //End月

            m.ProjectNO   = txtProjectNO.Text.Trim();          //项目编号
            m.ProjectName = txtProjectName.Text.Trim();        //项目名称
            m.ProjectType = ddl_ptype.SelectedValue;           //项目类型
            m.Str5        = ddl_pc.SelectedValue;              //类别

            decimal money = Common.StrToDecimal(txtGJJF.Text.Trim(), 0);
            if (money <= 0)
            {
                Jscript.Alert("实到经费必须大于0");
                return;
            }
            m.float1 = money;//实到经费
            //项目级别
            if (m.ProjectType == "F")
            {
                if (money >= 800)
                {
                    m.float2 = 5;//float2 F类 N 经费权重
                }
                if (500 <= money && money < 800)
                {
                    m.float2 = 4.8M;
                }
                if (300 <= money && money < 500)
                {
                    m.float2 = 4.6M;
                }
                if (200 <= money && money < 300)
                {
                    m.float2 = 4.4M;
                }
                if (150 <= money && money < 200)
                {
                    m.float2 = 4.2M;
                }
                if (100 <= money && money < 150)
                {
                    m.float2 = 4M;
                }
                if (70 <= money && money < 100)
                {
                    m.float2 = 3.6M;
                }
                if (50 <= money && money < 70)
                {
                    m.float2 = 3M;
                }
                if (20 <= money && money < 50)
                {
                    m.float2 = 2.4M;
                }
                if (money < 20)
                {
                    m.float2 = 2M;
                }
            }
            else
            {
                if (m.ProjectType == "A")
                {
                    m.float2 = 8;
                }
                if (m.ProjectType == "B")
                {
                    m.float2 = 5;
                }
                if (m.ProjectType == "C")
                {
                    m.float2 = 4;
                }
                if (m.ProjectType == "D")
                {
                    m.float2 = 3;
                }
                if (m.ProjectType == "E")
                {
                    m.float2 = 2;
                }
            }
            m.float3 = Common.StrToDecimal(txt_self_lv.Text.Trim(), 0);//本人贡献比例
            if (m.float3 <= 0 || m.float3 >= 1)
            {
                Jscript.Alert("本人贡献比例错误!数值范围0~1");
            }
            if (!string.IsNullOrEmpty(txtJS1.Text.Trim()))
            {
                m.Str1   = txtJS1.Text.Trim();
                m.float4 = Common.StrToDecimal(txt_js1_lv.Text.Trim(), 0);//教师一 贡献比例
                if (m.float4 <= 0 || m.float4 >= 1)
                {
                    Jscript.Alert("教师1贡献比例错误!数值范围0~1");
                    return;
                }
            }
            if (!string.IsNullOrEmpty(txtJS2.Text.Trim()))
            {
                m.Str2   = txtJS2.Text.Trim();
                m.float5 = Common.StrToDecimal(txt_js2_lv.Text.Trim(), 0);//教师2 贡献比例
                if (m.float5 <= 0 || m.float5 >= 1)
                {
                    Jscript.Alert("教师2贡献比例错误!数值范围0~1");
                    return;
                }
            }

            if (!string.IsNullOrEmpty(txtJS3.Text.Trim()))
            {
                m.Str3   = txtJS3.Text.Trim();
                m.float6 = Common.StrToDecimal(txt_js3_lv.Text.Trim(), 0);//教师3 贡献比例
                if (m.float6 <= 0 || m.float6 >= 1)
                {
                    Jscript.Alert("教师3贡献比例错误!数值范围0~1");
                    return;
                }
            }
            if (!string.IsNullOrEmpty(txtJS4.Text.Trim()))
            {
                m.Str4   = txtJS4.Text.Trim();
                m.float7 = Common.StrToDecimal(txt_js4_lv.Text.Trim(), 0);//教师2 贡献比例
                if (m.float7 <= 0 || m.float7 >= 1)
                {
                    Jscript.Alert("教师4贡献比例错误!数值范围0~1");
                    return;
                }
            }

            int i = bll.Add(m);
            if (i > 0)
            {
                Jscript.AlertAndRedirect("添加成功", "/KPIManage.aspx?id=" + TableID);
            }
            else
            {
                Jscript.Alert("添加失败,请稍后再试");
            }
        }
    }
Пример #48
0
    protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
    {
        if (e.CommandName == "alpha" || e.CommandName == "NoFilter")
        {
            String value = null;
            switch (e.CommandName)
            {
            case ("alpha"):
            {
                value = string.Format("{0}%", e.CommandArgument);
                break;
            }

            case ("NoFilter"):
            {
                value = "%";
                break;
            }
            }
            ObjectDataSource1.SelectParameters["ArticleTitle"].DefaultValue = value;
            ObjectDataSource1.DataBind();
            RadGrid1.Rebind();
        }
        else if (e.CommandName == "QuickUpdate")
        {
            string ArticleID, Priority, IsShowOnHomePage, IsHot, IsNew, IsAvailable;
            var    oArticle = new Article();

            foreach (GridDataItem item in RadGrid1.Items)
            {
                ArticleID        = item.GetDataKeyValue("ArticleID").ToString();
                Priority         = ((RadNumericTextBox)item.FindControl("txtPriority")).Text.Trim();
                IsShowOnHomePage = ((CheckBox)item.FindControl("chkIsShowOnHomePage")).Checked.ToString();
                IsHot            = ((CheckBox)item.FindControl("chkIsHot")).Checked.ToString();
                IsNew            = ((CheckBox)item.FindControl("chkIsNew")).Checked.ToString();
                IsAvailable      = ((CheckBox)item.FindControl("chkIsAvailable")).Checked.ToString();

                oArticle.ArticleQuickUpdate(
                    ArticleID,
                    IsShowOnHomePage,
                    IsHot,
                    IsNew,
                    IsAvailable,
                    Priority
                    );
            }
        }
        else if (e.CommandName == "DeleteSelected")
        {
            string OldImageName;
            var    oArticle = new Article();

            foreach (GridDataItem item in RadGrid1.SelectedItems)
            {
                OldImageName = ((HiddenField)item.FindControl("hdnImageName")).Value;
                DeleteImage(OldImageName);
            }
        }
        else if (e.CommandName == "PerformInsert" || e.CommandName == "Update")
        {
            var command       = e.CommandName;
            var row           = command == "PerformInsert" ? (GridEditFormInsertItem)e.Item : (GridEditFormItem)e.Item;
            var FileImageName = (RadUpload)row.FindControl("FileImageName");
            var oArticle      = new Article();

            string strArticleID             = ((HiddenField)row.FindControl("hdnArticleID")).Value;
            string strOldImageName          = ((HiddenField)row.FindControl("hdnOldImageName")).Value;
            string strImageName             = FileImageName.UploadedFiles.Count > 0 ? FileImageName.UploadedFiles[0].GetName() : "";
            string strPriority              = ((RadNumericTextBox)row.FindControl("txtPriority")).Text.Trim();
            string strMetaTittle            = ((TextBox)row.FindControl("txtMetaTittle")).Text.Trim();
            string strMetaDescription       = ((TextBox)row.FindControl("txtMetaDescription")).Text.Trim();
            string strArticleTitle          = ((TextBox)row.FindControl("txtArticleTitle")).Text.Trim();
            string strConvertedArticleTitle = Common.ConvertTitle(strArticleTitle);
            string strDescription           = HttpUtility.HtmlDecode(FCKEditorFix.Fix(((RadEditor)row.FindControl("txtDescription")).Content.Trim()));
            string strContent           = HttpUtility.HtmlDecode(FCKEditorFix.Fix(((RadEditor)row.FindControl("txtContent")).Content.Trim()));
            string strTag               = ((TextBox)row.FindControl("txtTag")).Text.Trim();
            string strArticleCategoryID = ((RadComboBox)row.FindControl("ddlCategory")).SelectedValue;
            string strIsShowOnHomePage  = ((CheckBox)row.FindControl("chkIsShowOnHomePage")).Checked.ToString();
            string strIsHot             = ((CheckBox)row.FindControl("chkIsHot")).Checked.ToString();
            string strIsNew             = ((CheckBox)row.FindControl("chkIsNew")).Checked.ToString();
            string strIsAvailable       = ((CheckBox)row.FindControl("chkIsAvailable")).Checked.ToString();
            string strMetaTittleEn      = ((TextBox)row.FindControl("txtMetaTittleEn")).Text.Trim();
            string strMetaDescriptionEn = ((TextBox)row.FindControl("txtMetaDescriptionEn")).Text.Trim();
            string strArticleTitleEn    = ((TextBox)row.FindControl("txtArticleTitleEn")).Text.Trim();
            string strDescriptionEn     = ((RadEditor)row.FindControl("txtDescriptionEn")).Content.Trim();
            string strContentEn         = ((RadEditor)row.FindControl("txtContentEn")).Content.Trim();
            string strTagEn             = ((TextBox)row.FindControl("txtTagEn")).Text.Trim();


            if (e.CommandName == "PerformInsert")
            {
                strImageName = oArticle.ArticleInsert(
                    strImageName,
                    strMetaTittle,
                    strMetaDescription,
                    strArticleTitle,
                    strConvertedArticleTitle,
                    strDescription,
                    strContent,
                    strTag,
                    strMetaTittleEn,
                    strMetaDescriptionEn,
                    strArticleTitleEn,
                    strDescriptionEn,
                    strContentEn,
                    strTagEn,
                    strArticleCategoryID,
                    strIsShowOnHomePage,
                    strIsHot,
                    strIsNew,
                    strIsAvailable,
                    strPriority
                    );

                string strFullPath = "~/res/article/" + strImageName;
                if (!string.IsNullOrEmpty(strImageName))
                {
                    FileImageName.UploadedFiles[0].SaveAs(Server.MapPath(strFullPath));
                    ResizeCropImage.ResizeByCondition(strFullPath, 800, 800);
                    ResizeCropImage.CreateThumbNailByCondition("~/res/article/", "~/res/article/thumbs/", strImageName, 120, 120);
                }
                RadGrid1.Rebind();
            }
            else
            {
                var dsUpdateParam        = ObjectDataSource1.UpdateParameters;
                var strOldImagePath      = Server.MapPath("~/res/article/" + strOldImageName);
                var strOldThumbImagePath = Server.MapPath("~/res/article/thumbs/" + strOldImageName);

                dsUpdateParam["ArticleTitle"].DefaultValue          = strArticleTitle;
                dsUpdateParam["ConvertedArticleTitle"].DefaultValue = strConvertedArticleTitle;
                dsUpdateParam["ImageName"].DefaultValue             = strImageName;
                dsUpdateParam["ArticleCategoryID"].DefaultValue     = strArticleCategoryID;
                dsUpdateParam["IsShowOnHomePage"].DefaultValue      = strIsShowOnHomePage;
                dsUpdateParam["IsHot"].DefaultValue       = strIsHot;
                dsUpdateParam["IsNew"].DefaultValue       = strIsNew;
                dsUpdateParam["IsAvailable"].DefaultValue = strIsAvailable;

                if (!string.IsNullOrEmpty(strImageName))
                {
                    if (File.Exists(strOldImagePath))
                    {
                        File.Delete(strOldImagePath);
                    }
                    if (File.Exists(strOldThumbImagePath))
                    {
                        File.Delete(strOldThumbImagePath);
                    }

                    strImageName = (string.IsNullOrEmpty(strConvertedArticleTitle) ? "" : strConvertedArticleTitle + "-") + strArticleID + strImageName.Substring(strImageName.LastIndexOf('.'));

                    string strFullPath = "~/res/article/" + strImageName;

                    FileImageName.UploadedFiles[0].SaveAs(Server.MapPath(strFullPath));
                    ResizeCropImage.ResizeByCondition(strFullPath, 800, 800);
                    ResizeCropImage.CreateThumbNailByCondition("~/res/article/", "~/res/article/thumbs/", strImageName, 120, 120);
                }
            }
        }
        if (e.CommandName == "DeleteImage")
        {
            var oArticle       = new Article();
            var lnkDeleteImage = (LinkButton)e.CommandSource;
            var s            = lnkDeleteImage.Attributes["rel"].ToString().Split('#');
            var strArticleID = s[0];
            var strImageName = s[1];

            oArticle.ArticleImageDelete(strArticleID);
            DeleteImage(strImageName);
            RadGrid1.Rebind();
        }
    }
Пример #49
0
 public IQueryable <UserSecurity> GetUserSecurities()
 {
     _command.ActiveUser = Common.GetActiveUser();
     return(_command.GetUserSecurities(_command.ActiveUser).AsQueryable());
 }
Пример #50
0
    string op;   //操作

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["SHUUser"] == null)
        {
            Jscript.AlertAndRedirect("未登录或登录超时,请重新登录", "/Login.aspx");
            Response.End();
        }
        else
        {
            currUser = Session["SHUUser"] as SHUniversity.KPI.Model.Users;
            string id = Request.QueryString["id"];

            TableID = Common.StrToInt(id, -1);
            if (TableID < 0)
            {
                Jscript.AlertAndRedirect("无法找到考核表信息", "../Home.aspx");
                return;
            }
            if (!kpibll.Exists(TableID, currUser.WorkID))
            {
                Jscript.AlertAndRedirect("考核表与用户信息不匹配", "../Home.aspx");
                return;
            }
            if (!kpibll.isEdit(TableID))
            {
                Jscript.AlertAndRedirect("考核表只有在未提交和驳回的时候才可以修改", "../Home.aspx");
                return;
            }
            if (!IsPostBack)
            {
                op = Request.QueryString["op"];
                string cid = Request.QueryString["cxsyid"];
                //根据操作参数判断是新增、删除、编辑
                int cxsyid;       //itemID
                int.TryParse(cid, out cxsyid);
                if (op == "edit") //编辑----初始赋值
                {
                    SHUniversity.KPI.Model.KPIItems m = bll.GetModel(cxsyid, currUser.WorkID);
                    if (m != null)
                    {
                        hid_cid.Value = cxsyid.ToString();
                        //何年月至何年月
                        ddl_pstartyear.SelectedValue  = m.Int1.ToString(); //开始年
                        ddl_pstartmonth.SelectedValue = m.Int2.ToString(); //开始月
                        ddl_pendyear.SelectedValue    = m.Int3.ToString(); //End年
                        ddl_pendmonth.SelectedValue   = m.Int4.ToString(); //End月


                        txtProjectNO.Text       = m.ProjectNO;                       //项目编号
                        txtProjectName.Text     = m.ProjectName;                     //项目名称
                        ddl_ptype.SelectedValue = m.ProjectType;                     //项目类型

                        txtGJJF.Text = Math.Round(m.float1.Value, 2).ToString();     //实到经费

                        txt_self_lv.Text = Math.Round(m.float3.Value, 2).ToString(); //本人贡献比例
                        txtJS1.Text      = m.Str1;
                        txtJS2.Text      = m.Str2;
                        txtJS3.Text      = m.Str3;
                        txtJS4.Text      = m.Str4;


                        txt_js1_lv.Text = m.float4 == null?"": Math.Round(m.float4.Value, 2).ToString();
                        txt_js2_lv.Text = m.float5 == null ? "" : Math.Round(m.float5.Value, 2).ToString();
                        txt_js3_lv.Text = m.float6 == null ? "" : Math.Round(m.float6.Value, 2).ToString();
                        txt_js4_lv.Text = m.float7 == null ? "" : Math.Round(m.float7.Value, 2).ToString();
                    }
                }
                if (op == "del")//删除
                {
                    bool r = bll.Delete(cxsyid, currUser.WorkID);
                    if (r)
                    {
                        Jscript.AlertAndRedirect("删除成功!", "/KPIManage.aspx?id=" + id);
                    }
                    else
                    {
                        Jscript.AlertAndRedirect("删除失败,请稍后再试", "/KPIManage.aspx?id=" + id);
                    }
                }
            }
        }
    }
Пример #51
0
 public TextBox(Rectangle aabb, string font)
 {
     AABB = aabb;
     Font = Common.str2Font(font);
 }
Пример #52
0
 public M4PL.Entities.JobService.JobPermission GetJobPermissions()
 {
     _command.ActiveUser = Common.GetActiveUser();
     return(_command.GetJobPermissions(_command.ActiveUser, GetTables(true).ToList()));
 }
 protected string progressTitle(object input)
 {
     return(Common.ConvertTitle(input.ToString()));
 }
Пример #54
0
        protected void rptTestimonilas_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            lblSeccessMsg.Visible = false;
            _objCommon            = new Common();
            try
            {
                if (e.CommandName == "Edit")
                {
                    hndCollegeTopHirer.Value = e.CommandArgument.ToString();
                    HiddenField hndCollegeBranchCourseID = (HiddenField)e.Item.FindControl("hndCollegeBranchCourseID");

                    var data = NewsArticleNoticeProvider.Instance.GetTestimonialsDetailsById(Convert.ToInt32(hndCollegeTopHirer.Value));


                    if (data.Count > 0)
                    {
                        var query = from result in data
                                    select new
                        {
                            UserId            = result.UserID,
                            Testimonial       = result.Testimonials,
                            TestimonialStatus = result.TestimonilaStatus,
                            UserName          = result.UserName,
                            UserImage         = result.UserImage,
                        };
                        var sp = query.First();

                        txtTesimonial.FckValue = sp.Testimonial;
                        txtName.Text           = sp.UserName;
                        string Img  = sp.UserImage != "" ? sp.UserImage : "N/A";
                        var    path = _objCommon.GetFilepath("NewsArticle");
                        hdnImageFile.Value = Img;

                        if (sp.TestimonialStatus == true)
                        {
                            chkStatus.Checked = true;
                        }
                        else
                        {
                            chkStatus.Checked = false;
                        }


                        //lblHeader.Text = "Add Exam Form Master";
                        btnSubmit.Text = "Update";
                        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "anyIdweqeewqe", "OpenPoup('divStudentTestomonialInsert','650px','sndAddTestomonual');", true);
                    }
                }
            }
            catch (Exception ex)
            {
                var err = ex.Message;
                if (ex.InnerException != null)
                {
                    err = err + " :: Inner Exception :- " + ex.InnerException.Message;
                }
                const string addInfo = "Error in Executing  rptCollegeList_ItemCommand in Testimonial.aspx :: -> ";
                var          objPub  = new ClsExceptionPublisher();
                objPub.Publish(err, addInfo);
            }
        }
Пример #55
0
 protected override string GetTitleB()
 {
     return(Common.Localize("ChangeCoworker:Coworker"));
 }
Пример #56
0
 /// <include file='XmlDocs/CommonXmlDocComments.xml' path='CommonXmlDocComments/Blocks/Member[@name="ToString"]/*' />
 public override string ToString()
 {
     return(Common.GetNameForDebugger(this, _source.DataflowBlockOptions));
 }
Пример #57
0
 private Vector2 GetSpawnPoint()
 {
     //calculate the point a little closer in from the paddle's position
     return(Common.GetPointOnCircle(paddle.CurrentAngle, paddle.BoundsRadius - renderer.bounds.size.y));
 }
Пример #58
0
        private void btLogin_Click(object sender, EventArgs e)
        {
            try
            {
                String connection = "Data Source=42.112.28.93;Initial Catalog=QT_2;Persist Security Info=True;User ID=wss_price;Password=HzlRt4$$axzG-*UlpuL2gYDu;connection timeout=200";
                //String connectionCrawler = "Data Source=192.168.100.183;Initial Catalog=QTCrawler;Integrated Security=False;User=sa;Password=123";
                //String connectionCrawler = @"Data Source=192.168.100.183;Initial Catalog=SaleNews;Integrated Security=False;User=sa;Password=123";
                String connectionCrawler = "Data Source=172.22.30.82,1452;Initial Catalog=QTCrawler;Persist Security Info=True;User ID=qt_vn;Password=@F4sJ=l9/ryJt9MT;connection timeout=200";
                String logConnection     = "Data Source=172.22.30.86,1455;Initial Catalog=QT_2;Persist Security Info=True;User ID=qt_vn;Password=@F4sJ=l9/ryJt9MT;connection timeout=200";

                switch (QT.Entities.Server.ServerRun)
                {
                case "store":
                    connection = connection.Replace("42.112.28.93", ".");
                    break;

                case "hvtcphc":
                    logConnection     = logConnection.Replace("118.70.205.94", "172.16.34.86");
                    connectionCrawler = connectionCrawler.Replace("118.70.205.94", ".");
                    break;

                case "hvtcdn":
                    logConnection     = logConnection.Replace("118.70.205.94", "10.168.200.86");
                    connectionCrawler = connectionCrawler.Replace("118.70.205.94", "10.168.200.82");
                    break;

                case "fpt":
                    connection = connection.Replace("42.112.28.93", "172.22.1.82");
                    break;
                }
                QT.Entities.Server.ConnectionString        = connection;
                QT.Entities.Server.ConnectionStringCrawler = connectionCrawler;
                QT.Entities.Server.LogConnectionString     = logConnection;

                adt.Connection.ConnectionString = QT.Entities.Server.ConnectionString;
                //adt.FillBy_UserPass(dt, txtUser.Text.Trim(), Common.GetPassWord(txtPass.Text.Trim()));
                adt.FillBy_UserPass(dt, txtUser.Text.Trim(), Bussiness.CryptoWSS.Encrypt(txtPass.Text.Trim()));

                if (dt.Rows.Count > 0)
                {
                    DialogResult           = DialogResult.OK;
                    QT.Users.User.UserName = txtUser.Text.Trim();
                    QT.Users.User.UserID   = Common.Obj2Int(dt.Rows[0]["ID"].ToString());
                    //Check Quyền
                    DBTableAdapters.User_PermisionTableAdapter userpermisionAdapter = new DBTableAdapters.User_PermisionTableAdapter();
                    userpermisionAdapter.Connection.ConnectionString = QT.Entities.Server.ConnectionString;
                    DB.User_PermisionDataTable userpermissionTable = new DB.User_PermisionDataTable();
                    userpermisionAdapter.FillBy_IDUser(userpermissionTable, QT.Users.User.UserID);
                    if (userpermissionTable.Rows.Count > 0)
                    {
                        List <int> listper = new List <int>();
                        for (int i = 0; i < userpermissionTable.Rows.Count; i++)
                        {
                            listper.Add(Common.Obj2Int(userpermissionTable.Rows[i]["IDPermission"].ToString()));
                        }
                        QT.Users.User.PermisionID = listper;
                    }

                    QT.Entities.Server.UserID = QT.Users.User.UserID;
                    //Log đăng nhập
                    LogJobAdapter.SaveLog(JobName.Login, "Đăng nhập Manager", 0, (int)JobTypeData.KhongXacDinh);

                    this.Close();
                }
                else
                {
                    MessageBox.Show("User hoặc mật khẩu không dúng, liên hệ với admin");
                    this.txtUser.Focus();
                    this.txtUser.SelectAll();
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Không kết nối được, bạn hãy thử kiểm tra lại mạng");
            }
        }
        /// <summary>
        /// Tries to get the request resource from the local resourcefile. If it fails, from the sharedresourcefile.
        /// Note that DNN itself also uses fallback to globalresources if the first one fails.
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public string GetString(string key, params object[] args)
        {
            var localResourceFile = Common.StripFileName(VirtualPath) + "App_LocalResources/Resources.resx";

            return(Common.GetString(key, localResourceFile, args));
        }
Пример #60
0
 protected override string GetTitleA()
 {
     return(Common.Localize("ChooseBoss:Employee"));
 }