Example #1
0
        private void DelOrg_Click(object sender, RoutedEventArgs e)
        {
            ActivityOrganization org = xDataGrid.SelectedItem as ActivityOrganization;

            if (org == null)
            {
                MessageBox.Show("请先选中要删除的单位信息,然后再次点击删除按钮", "操作提示");
                return;
            }
            else if (Equipments.Length > 0)
            {
                MessageBox.Show(string.Format("当前活动下,{0}已经包含设备,请先删除设备后再执行删除该单位的操作。", org.Name), "操作提示");
                return;
            }
            try
            {
                DataOperator.DeleteOrgByGuid(org.Guid);
                Organization[] orgs = xDataGrid.ItemsSource as Organization[];

                xDataGrid.ItemsSource = null;
                xDataGrid.ItemsSource = orgs.Where(p => p.Guid != org.Guid).ToArray();
                MessageBox.Show("删除成功");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.GetExceptionMessage(), "删除失败");
            }
        }
 public ActionResult DoUpdate(Category category)
 {
     DataOperator dop = new DataOperator(Runtime.SqlConfig);
     dop.Update(category);
     TemplateDataHelper.Categories = null;
     return Redirect("/Admin/Success.do");
 }
Example #3
0
        private Dictionary <string, string> GetMsgNoticInfo()
        {
            Dictionary <string, string> msg_dict = new Dictionary <string, string>();

            try
            {
                QueryParams queryParams = new QueryParams();
                queryParams.AddQueryDefines("OperDept", ExtendAppContext.Current.OperDeptCode);
                queryParams.AddQueryDefines("Type", 2);
                DataTable NoticMsgTable = DataOperator.HttpWebApi <DataResult>(ApiUrlEnum.GetNoticeMsgData, queryParams).ToDataTable();

                if (NoticMsgTable.Rows.Count > 0)
                {
                    foreach (DataRow dr in NoticMsgTable.Rows)
                    {
                        if (!msg_dict.ContainsKey(dr["ID"].ToString()))
                        {
                            msg_dict.Add(dr["ID"].ToString(), dr["MSG"].ToString() + "," + dr["COUNTS"].ToString());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionHandler.Handle(ex);
            }
            return(msg_dict);
        }
        //
        // GET: /ArticleTag/

        public ActionResult Index()
        {
            DataOperator dop = new DataOperator(Runtime.SqlConfig);
            List<ArticleTag> list = new List<ArticleTag>();
            list = dop.Select<ArticleTag>();
            return View(list);
        }
 public ActionResult DoDelete(Article article)
 {
     article.ACategoryName = "recycle";
     DataOperator dop = new DataOperator(Runtime.SqlConfig);
     dop.Update(article);
     return Redirect("/Admin/Success.do");
 }
Example #6
0
        private void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var item = (sender as DataGrid).SelectedItem;

            if (item == null)
            {
                return;
            }
            LoadEquipmentsForOrg();

            if (item is ActivityOrganization)
            {
                EquipmentLoadStrategy strategy = new EquipmentLoadStrategy();
                strategy.ActivityGuid = SystemLoginService.CurrentActivity.Guid;
                strategy.PlaceGuid    = SystemLoginService.CurrentActivityPlace.Guid;
                strategy.OrgName      = (item as ActivityOrganization).Name;
                if (DataOperator.GetEquipments(strategy).Length > 0)
                {
                    xDeleteButton.IsEnabled = false;
                }
                else
                {
                    xDeleteButton.IsEnabled = true;
                }
            }
        }
Example #7
0
        public static void Insert(ReimburseFlow entity, int reimburseID)
        {
            using (var dataOperator = new DataOperator(SqlHelper.HrmisConnectionString))
            {
                dataOperator.CommandText = @"
 INSERT INTO TReimburseFlow(
ReimburseID,
OperatorID,
ReimburseStatus,
OperationTime
)
    VALUES (
@ReimburseID,
@OperatorID,
@ReimburseStatus,
@OperationTime
)

";
                dataOperator.SetParameter("@ReimburseID", reimburseID, SqlDbType.Int);
                dataOperator.SetParameter("@OperatorID", entity.Operator.Account.Id, SqlDbType.Int);
                dataOperator.SetParameter("@ReimburseStatus", entity.ReimburseStatusEnum, SqlDbType.Int);
                dataOperator.SetParameter("@OperationTime", entity.OperationTime, SqlDbType.DateTime);
                dataOperator.ExecuteNonQuery();
            }
        }
Example #8
0
        public void Install(SqlConfig config, User user)
        {
            Runtime.SqlConfig = config;

            DataOperator dop = new DataOperator(Runtime.SqlConfig);

            //创建数据库
            string db_path = Runtime.SqlConfig.DataBasePath.Replace("~", AppDomain.CurrentDomain.BaseDirectory);

            if (!Installer.HasInstall && File.Exists(db_path))
                File.Delete(db_path);

            dop.DataDriver.CreateDataBase(db_path, Runtime.SqlConfig.PassWord);

            //创建表:User
            dop.CreateTable<User>();
            dop.Insert(user);
            //创建表:Article
            dop.CreateTable<Article>();
            //创建表:Category
            dop.CreateTable<Category>();

            //保存数据库配置
            string sql_config_path = AppDomain.CurrentDomain.BaseDirectory + SystemCoreStrings.FILE_CORE_SQLCONFIG;
            Runtime.SqlConfig.Save(sql_config_path);

            //创建安装安全锁
            File.Create(AppDomain.CurrentDomain.BaseDirectory + SystemCoreStrings.FILE_CORE_INSTALL_LOCK);
        }
Example #9
0
        /// <summary>
        /// 获取当前的日期和时间
        /// </summary>
        private void GetCurrentTime()
        {
            DateTime now     = DataOperator.HttpWebApi <DateTime>(ApiUrlEnum.GetServerDateTime, null);
            string   en_week = now.DayOfWeek.ToString();
            string   week    = "";

            switch (en_week)
            {
            case "Monday": week = "星期一"; break;

            case "Tuesday": week = "星期二"; break;

            case "Wednesday": week = "星期三"; break;

            case "Thursday": week = "星期四"; break;

            case "Friday": week = "星期五"; break;

            case "Saturday": week = "星期六"; break;

            case "Sunday": week = "星期日"; break;
            }
            curnt_time = week + " " + now.ToString("yyyy年MM月dd日 HH:mm");
            screenPnlTime.Refresh();
        }
Example #10
0
        public static List <ExchangeRateEntity> GetExchangeRateByCondition(string name, DateTime?activeDate)
        {
            using (DataOperator dataOperator = new DataOperator(SqlHelper.HrmisConnectionString))
            {
                dataOperator.CommandText =
                    @"
SELECT 
	*
FROM [dbo].[TExchangeRate] WITH(NOLOCK)
WHERE
	1=1 
";
                if (!string.IsNullOrEmpty(name))
                {
                    dataOperator.CommandText += " and Name like @Name";
                    dataOperator.SetParameter("@Name", "%" + name + "%", SqlDbType.NVarChar, 200);
                }
                if (activeDate != null)
                {
                    dataOperator.CommandText += " and ActiveDate=@ActiveDate";
                    dataOperator.SetParameter("@ActiveDate", activeDate, SqlDbType.SmallDateTime);
                }
                dataOperator.CommandText += " order by ActiveDate desc";
                return(dataOperator.ExecuteEntityList <ExchangeRateEntity>());
            }
        }
        public static Article GetArticle(string articleName)
        {
            DataOperator dop = new DataOperator(Runtime.SqlConfig);

            Article article = dop.SelectSingle<Article>("AName='" + articleName + "'");
            return article;
        }
Example #12
0
        public static List <VacationEntity> GetVacationByCondition(string employeeName, decimal vacationDayNumStart,
                                                                   decimal vacationDayNumEnd,
                                                                   DateTime vacationEndDateStart,
                                                                   DateTime vacationEndDateEnd,
                                                                   decimal surplusDayNumStart, decimal surplusDayNumEnd,
                                                                   int employeeStatus, List <int> canOperateDepartment)
        {
            using (DataOperator dataOperator = new DataOperator(SqlHelper.HrmisConnectionString))
            {
                dataOperator.CommandText =
                    string.Format(
                        @"
select a.* from TVacation as a with(nolock)
inner join TEmployee as c with(nolock) on a.AccountID=c.AccountID
inner join {0}.dbo.TAccount as b with(nolock) on a.AccountID=b.PKID
where a.EmployeeName like @EmployeeName and VacationEndDate>=@VacationEndDateStart and VacationEndDate<=@VacationEndDateEnd
",
                        SqlHelper.SEPDBName);

                dataOperator.SetParameter("@VacationEndDateStart", vacationEndDateStart, SqlDbType.DateTime);
                dataOperator.SetParameter("@VacationEndDateEnd", vacationEndDateEnd, SqlDbType.DateTime);
                dataOperator.SetParameter("@EmployeeName", "%" + employeeName + "%", SqlDbType.NVarChar, 50);
                if (vacationDayNumStart >= 0)
                {
                    dataOperator.CommandText += " and VacationDayNum>=@VacationDayNumStart";
                    dataOperator.SetParameter("@VacationDayNumStart", vacationDayNumStart, SqlDbType.Decimal);
                }
                if (vacationDayNumEnd >= 0)
                {
                    dataOperator.CommandText += " and VacationDayNum<=@VacationDayNumEnd";
                    dataOperator.SetParameter("@VacationDayNumEnd", vacationDayNumEnd, SqlDbType.Decimal);
                }
                if (surplusDayNumStart >= 0)
                {
                    dataOperator.CommandText += " and SurplusDayNum>=@SurplusDayNumStart";
                    dataOperator.SetParameter("@SurplusDayNumStart", surplusDayNumStart, SqlDbType.Decimal);
                }
                if (surplusDayNumEnd >= 0)
                {
                    dataOperator.CommandText += " and SurplusDayNum<=@SurplusDayNumEnd";
                    dataOperator.SetParameter("@SurplusDayNumEnd", surplusDayNumEnd, SqlDbType.Decimal);
                }
                if (canOperateDepartment != null && canOperateDepartment.Count > 0)
                {
                    dataOperator.CommandText += " and DepartmentId in (" + string.Join(",", canOperateDepartment) + ")";
                }
                //在职
                if (employeeStatus == 0)
                {
                    dataOperator.CommandText +=
                        " and ComeDate<=getdate() and (LeaveDate is null or LeaveDate > getdate())";
                }
                //离职
                else if (employeeStatus == 1)
                {
                    dataOperator.CommandText += " and LeaveDate<getdate()";
                }
                return(dataOperator.ExecuteEntityList <VacationEntity>());
            }
        }
Example #13
0
        public static List<DepartmentEntity> GetCompanyByAccountAuth(int accountId, int authID)
        {
            using (DataOperator dataOperator = new DataOperator(SqlHelper.HrmisConnectionString))
            {
                dataOperator.CommandText =
                    @"
if exists (select DepartmentID from TAccountAuth with(nolock) where AccountId=@AccountId and AuthId=@AuthID and DepartmentID>0)
begin 
select PKID,DepartmentName,LeaderId,ParentId
from " +
                    SqlHelper.SEPDBName +
                    @".dbo.TDepartment with(nolock) 
where PKID in(
select DepartmentID from TAccountAuth with(nolock) where AccountId=@AccountId and AuthId=@AuthID
) and PKID in (select CompanyID from TEmployee)
end
else
select PKID,DepartmentName,LeaderId,ParentId
from " +
                    SqlHelper.SEPDBName +
                    @".dbo.TDepartment with(nolock) 
where PKID in (select CompanyID from TEmployee)
";
                dataOperator.SetParameter("@AccountId", accountId, SqlDbType.Int);
                dataOperator.SetParameter("@AuthID", authID, SqlDbType.Int);
                return dataOperator.ExecuteEntityList<DepartmentEntity>();
            }
        }
Example #14
0
        private void btnChongZhi_Click(object sender, EventArgs e)
        {
            DataOperator dop = new DataOperator(UccRuntime.SqlConfig);
            User user = new User();
            user.UserID = this.txtUserID.Text;
            user = dop.SelectSingle(user) as User;

            double shishou = 0;
            if (double.TryParse(this.txtShiShou.Text, out shishou))
                user.Money += shishou;
            double zengsong = 0;
            if (double.TryParse(this.txtZengSong.Text, out zengsong))
                user.Money += zengsong;
            //user.Money = double.Parse(this.txtMoney.Text) + double.Parse(this.txtShiShou.Text) + int.Parse(this.txtZengSong.Text);
            dop.Update(user);

            MoneyHistory history = new MoneyHistory();
            history.UserID = this.txtUserID.Text;
            history.UserName = this.txtUserName.Text;
            history.MoneyID = "M" + DateTime.Now.ToString("yyyyMMdd") + dop.Count<MoneyHistory>();
            history.MoneyTime = DateTime.Now;
            history.ShiShouMoney = shishou;
            history.ZengSongMoney = zengsong;
            dop.Insert(history);
            dop.Commit();

            MessageBox.Show("操作成功!");
        }
Example #15
0
        public static void Insert(ReceiveMessagesEntity entity)
        {
            using (var dataOperator = new DataOperator("app", "SMS"))
            {
                dataOperator.CommandText = @"
INSERT INTO [dbo].[T_ReceiveMessages]
           ([BoradCasted]
           ,[Id]
           ,[TheNumber]
           ,[Content]
           ,[ReceivedTime]
           ,[IsCleanMessage])
     VALUES
           (@BoradCasted
           ,@Id
           ,@TheNumber
           ,@Content
           ,@ReceivedTime
           ,@IsCleanMessage)
GO
 SELECT @@IDENTITY
";
                dataOperator.SetParameter("@BoradCasted", entity.BoradCasted, SqlDbType.Int);
                dataOperator.SetParameter("@Id", entity.Id, SqlDbType.Int);
                dataOperator.SetParameter("@TheNumber", entity.TheNumber, SqlDbType.NVarChar, 50);
                dataOperator.SetParameter("@Content", entity.Content, SqlDbType.NVarChar, 2000);
                dataOperator.SetParameter("@ReceivedTime", entity.ReceivedTime, SqlDbType.DateTime);
                dataOperator.SetParameter("@IsCleanMessage", entity.IsCleanMessage, SqlDbType.Int);
                object obj = dataOperator.ExecuteScalar();
                int    returnValue;
                int.TryParse(obj.ToString(), out returnValue);
                entity.PKID = returnValue;
            }
        }
Example #16
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            SqlConfig config = new SqlConfig(DataDriverType.Sqlite, this.txtDataPre.Text, "", this.txtDBPath.Text);
            DataOperator dop = new DataOperator(config);

            Compile.CSharpCodeCompiler compiler = new Compile.CSharpCodeCompiler();

            foreach(var item in this.lbxModels.Items)
            {
                try
                {
                    var assembly = compiler.Compile(File.ReadAllText(item.ToString()));

                    foreach (var type in assembly.GetTypes())
                    {
                        dop.CreateTable(type);
                    }
                    MessageBox.Show("操作成功!");
                }
                catch(Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }

            }
        }
 public ActionResult DoUpdate(Article article)
 {
     DataOperator dop = new DataOperator(Runtime.SqlConfig);
     article.ATime = DateTime.Now;
     dop.Update(article);
     return Redirect("/Admin/Success.do");
 }
Example #18
0
        public static void InsertExchangeRate(ExchangeRateEntity exchangeRateEntity)
        {
            using (DataOperator dataOperator = new DataOperator(SqlHelper.HrmisConnectionString))
            {
                dataOperator.CommandText =
                    @"
INSERT INTO [dbo].[TExchangeRate](
	[Name],
	[Rate],
    [Symbol],
    [ActiveDate]
	) VALUES(
	@Name,
	@Rate,
    @Symbol,
    @ActiveDate)
    SELECT @@IDENTITY
";
                dataOperator.SetParameter("@Name", exchangeRateEntity.Name, SqlDbType.NVarChar, 200);
                dataOperator.SetParameter("@Rate", exchangeRateEntity.Rate, SqlDbType.Decimal, 12, 4);
                dataOperator.SetParameter("@ActiveDate", exchangeRateEntity.ActiveDate, SqlDbType.SmallDateTime);
                dataOperator.SetParameter("@Symbol", exchangeRateEntity.Symbol, SqlDbType.NVarChar, 5);
                object obj = dataOperator.ExecuteScalar();
                int    returnValue;
                int.TryParse(obj.ToString(), out returnValue);
                exchangeRateEntity.PKID = returnValue;
            }
        }
Example #19
0
        /// <summary>
        /// 初始化加载大屏控件
        /// </summary>
        private void InitialScreenControl()
        {
            XtraUserControl userCtr = null;

            try
            {
                //if (ExtendAppContext.Current.ShowScreenNo > 1)
                {
                    this.Left = System.Windows.Forms.Screen.AllScreens[ExtendAppContext.Current.ScreenIndex].Bounds.Left;
                    this.Top  = System.Windows.Forms.Screen.AllScreens[ExtendAppContext.Current.ScreenIndex].Bounds.Top;
                }
                QueryParams queryParams = new QueryParams();
                queryParams.AddQueryDefines("ScreenNo", OperationEnum.Equal, ExtendAppContext.Current.CurntScreenNo);
                DataTable screenDictData = DataOperator.HttpWebApi <DataResult>(ApiUrlEnum.GetScreenDict, queryParams).ToDataTable();
                if (screenDictData != null && screenDictData.Rows.Count > 0)
                {
                    string typeName = screenDictData.Rows[0]["SCREEN_TYPE"].ToString();
                    ExtendAppContext.Current.ScreenLabel = screenDictData.Rows[0]["SCREEN_LABEL"].ToString();
                    bool isFullScreen = screenDictData.Rows[0]["FULL_SCREEN"].ToString() == "1";
                    int  width        = int.Parse(screenDictData.Rows[0]["SCREEN_WIDTH"].ToString());
                    int  height       = int.Parse(screenDictData.Rows[0]["SCREEN_HEIGHT"].ToString());
                    if (isFullScreen)
                    {
                        this.WindowState = FormWindowState.Maximized;
                    }
                    else
                    {
                        this.Width  = width;
                        this.Height = height;
                    }
                    ExtendAppContext.Current.CurntScreentType = ScreenTypeHelper.GetScreenTypeByName(typeName);
                    TransMessageManager.Instance.OpenConnection();
                }
                else
                {
                    //new frmMessageBox().Show("未获取到当前大屏的配置信息,请完成大屏配置后重新登录。", "大屏提示", MessageBoxButtons.OK, MessageBoxIcon.Information, 0);
                    AutoClosedMsgBox.Show("未获取到当前大屏的配置信息,请完成大屏配置后重新登录。", "大屏提示", 0, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Environment.Exit(0);
                }
            }
            catch (Exception ex)
            {
                ExceptionHandler.Handle(ex);
            }
            switch (ExtendAppContext.Current.CurntScreentType)
            {
            case ScreenType.OperScheduleScreen:
                userCtr = new OperScheduleScreen();
                (userCtr as OperScheduleScreen).parentDoubleClick += new EventHandler(MainScreenFrm_DoubleClick);
                break;

            case ScreenType.FamilyWaitScreen:
                userCtr = new FamilyWaitScreen();
                (userCtr as FamilyWaitScreen).parentDoubleClick += new EventHandler(MainScreenFrm_DoubleClick);
                break;
            }
            userCtr.Parent = this;
            userCtr.Dock   = DockStyle.Fill;
        }
        public void ThenItShouldThrowExceptionIfInvalidOperatorUsed(string field, DataOperator @operator, string value)
        {
            var actual = Assert.Throws <ArgumentException>(() =>
                                                           new CosmosQuery(CosmosCombinationOperator.And)
                                                           .AddCondition(field, @operator, value));

            Assert.AreEqual($"Operator {@operator.ToString()} is not valid for field {field}. Valid operators are Between, Equals, GreaterThan, GreaterThanOrEqualTo, LessThan, LessThanOrEqualTo, IsNull and IsNotNull", actual.Message);
        }
 public ActionResult Article(string categoryName, string articleName)
 {
     DataOperator dop = new DataOperator(Runtime.SqlConfig);
     Article item = new FreeRoo.Article();
     item.AName = articleName;
     item = dop.SelectSingle(item) as Article;
     return View(item);
 }
 public ActionResult Update(string ArticleID)
 {
     DataOperator dop = new DataOperator(Runtime.SqlConfig);
     Article article = new Article();
     article.ArticleID = ArticleID;
     article = dop.SelectSingle(article) as Article;
     return View(article);
 }
 public ActionResult Update(string categoryName)
 {
     DataOperator dop=new DataOperator(Runtime.SqlConfig);
     Category category = new Category();
     category.CategoryName = categoryName;
     category = dop.SelectSingle(category) as Category;
     return View(category);
 }
Example #24
0
 //public Visibility ToolBarDisplay
 //{
 //    set
 //    {
 //        _toolBar.Visibility = value;
 //    }
 //}
 public EquipmentsManageCtrl()
 {
     InitializeComponent();
     xDataGrid.ItemsSource = DataOperator.GetORGSource(new OrgQueryCondition()
     {
         ActivityGuid = SystemLoginService.CurrentActivity.Guid
     });
 }
Example #25
0
 private void btnUserID_Click(object sender, EventArgs e)
 {
     DataOperator dop = new DataOperator(UccRuntime.SqlConfig);
     User user = new User();
     user.UserID = this.txtUserID.Text;
     user = dop.SelectSingle(user) as User;
     this.txtUserName.Text = user.UserName;
     this.txtMoney.Text = user.Money.ToString();
 }
 public void InterfereAnalyseRealize(List <ActivityEquipment> equs)
 {
     if (VerifyAssignFreq(equs, false))
     {
         List <ActivitySurroundStation> surroundstation = DataOperator.GetAroundStations();
         InterfereAnalyseDialog         interfdialog    = new InterfereAnalyseDialog(equs, surroundstation);
         interfdialog.ShowDialog();
     }
 }
Example #27
0
        public void Setup()
        {
            inter = new Intervention();
            user  = new Users();
            user.setPassword("123456");
            user.setLoginname("user1");

            data_operator = new DataLayer.DataOperator();
        }
Example #28
0
        private List <ActivityEquipmentInfo> GetActivityEquipmentInfo1(FreqPlanActivity p_freqPlan)
        {
            EquipmentQueryCondition equipCondition = new EquipmentQueryCondition();

            equipCondition.ActivityGuid = "344BF3F8C4DF4CCCB7DCC341DC8EEBB0";//p_freqPlan.ActivityId;
            equipCondition.IsMobile     = true;
            //equipCondition.PlaceGuid = SystemLoginService.CurrentActivityPlace.Guid;
            return(DataOperator.GetTaskListInfosByParam(equipCondition));
        }
Example #29
0
 public static void DeleteProjectInfo(int pkid)
 {
     using (DataOperator dataOperator = new DataOperator(SqlHelper.HrmisConnectionString))
     {
         dataOperator.CommandText = @"Delete from  [dbo].[TProjectInfo] WHERE [PKID]=@PKID";
         dataOperator.SetParameter("@PKID", pkid, SqlDbType.Int);
         dataOperator.ExecuteNonQuery();
     }
 }
        public static List <AccountSetParaEntity> GetAllAccountSetParamEntity()
        {
            using (DataOperator dataOperator = new DataOperator(SqlHelper.HrmisConnectionString))
            {
                dataOperator.CommandText = @"
select PKID,AccountSetParaName from TAccountSetPara
";
                return(dataOperator.ExecuteEntityList <AccountSetParaEntity>());
            }
        }
Example #31
0
 public static DataOperator GetInstance()
 {
     lock (_instance) {
         if (_instance == null)
         {
             _instance = new DataOperator();
         }
     }
     return(_instance);
 }
 public ActionResult DoAdd(Article article)
 {
     DataOperator dop = new DataOperator(Runtime.SqlConfig);
     article.ArticleID = Guid.NewGuid().ToString();
     article.ATime = DateTime.Now;
     article.AR = 0;
     dop.Insert(article);
     dop.Commit();
     return Redirect("/Admin/Success.do");
 }
Example #33
0
        public static SendMessagesEntity GetOneToSend()
        {
            using (var dataOperator = new DataOperator("app", "SMS"))
            {
                dataOperator.CommandText = @"
select top 1 * from  [dbo].[T_SendMessages] with(nolock) where TriedCount<3 and SendStatusEnum=0 order by pkid desc
";
                return(dataOperator.ExecuteEntity <SendMessagesEntity>());
            }
        }
Example #34
0
        public static ProjectInfoEntity GetProjectInfoByCode(string code)
        {
            using (DataOperator dataOperator = new DataOperator(SqlHelper.HrmisConnectionString))
            {
                dataOperator.CommandText = @"select * from [dbo].[TProjectInfo] with(nolock) where  [ProjectName] like @Code";

                dataOperator.SetParameter("@Code", "%-" + code + " %", SqlDbType.NVarChar, 200);
                return(dataOperator.ExecuteEntity <ProjectInfoEntity>());
            }
        }
Example #35
0
 public static void UpdateReimburseStatus(int id, ReimburseStatusEnum status)
 {
     using (var dataOperator = new DataOperator(SqlHelper.HrmisConnectionString))
     {
         dataOperator.CommandText = "Update TReimburse set ReimburseStatus=@ReimburseStatus where PKID=@PKID";
         dataOperator.SetParameter("@ReimburseStatus", (int)status, SqlDbType.Int);
         dataOperator.SetParameter("@PKID", id, SqlDbType.Int);
         dataOperator.ExecuteNonQuery();
     }
 }
Example #36
0
 /// <summary>
 /// Handles the Click event of the btnPrint control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 /// 整理人:桂书丛
 /// 整理时间:2013-02-02
 private void btnPrint_Click(object sender, EventArgs e)
 {
     try
     {
         DataOperator.DataPrint(this.gvInGoods, "入库信息", this);
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.Message);
     }
 }
 private void equInspectiondatagrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (EquipmentInspectionSelected != null && EquipmentInspectionSelected.ActivityEquipment != null)
     {
         ActivityEquipment     equip     = DataOperator.GetEquipmentByID(EquipmentInspectionSelected.ActivityEquipment.Key);
         EquipmentManageDialog equdialog = new EquipmentManageDialog();
         equdialog.AllowEdit   = false;
         equdialog.DataContext = equip;
         equdialog.ShowDialog();
     }
 }
Example #38
0
 private void btnDerived_Click(object sender, EventArgs e)
 {
     try
     {
         DataOperator.DataOut(this.gvEmployeeMain, "员工信息");
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.Message);
     }
 }
 public ActionResult GetLatest(string store)
 {
     DataOperator dop = new DataOperator(config);
     var result = dop.Select<BackUpInfo>(new BackUpInfo(), "", "BackUpTime DESC", 1, 0);
     if (result != null && result.Count > 0)
     {
         var latest = result[0];
         return Content(latest.FileName);
     }
     return Content("");
 }
Example #40
0
 private void btnPrint_Click(object sender, EventArgs e)
 {
     try
     {
         DataOperator.DataPrint(this.lvPerformance, "员工信息", null);
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.Message);
     }
 }
Example #41
0
 /// <summary>
 /// Handles the Click event of the btnStockOut control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 /// 整理人:桂书丛
 /// 整理时间:2013-02-02
 private void btnStockOut_Click(object sender, EventArgs e)
 {
     try
     {
         DataOperator.DataOut(this.gvStockMain, "库存信息");
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.Message);
     }
 }
Example #42
0
        private void miGeometry_Click(object sender, EventArgs e)
        {
            DataOperator dataoperator = new DataOperator(axMapControl1.Map);
            //ILayer layer;
            //layer = dataoperator.GetLayerByName("DLTB");
            //IFeatureLayer featureLayer = layer as IFeatureLayer;
            //IFeatureCursor featureCursor = featureLayer.Search(null, false);
            //IFeature feature = featureCursor.NextFeature();
            IGeometry geometry = new PolygonClass();

            geometry = m_polygon;

            IPointCollection pointCollection = (Polygon)geometry;
            DataTable        dataTable       = new DataTable();
            DataColumn       dataColumn      = new DataColumn();//创建列

            dataColumn            = new DataColumn();
            dataColumn.ColumnName = "number";//设置第一列,表示用户指定的列名
            dataColumn.DataType   = System.Type.GetType("System.String");
            dataTable.Columns.Add(dataColumn);

            dataColumn            = new DataColumn();
            dataColumn.ColumnName = "X";//设置第二列为在目标图层类作为分类标准的属性
            dataColumn.DataType   = System.Type.GetType("System.String");
            dataTable.Columns.Add(dataColumn);

            dataColumn            = new DataColumn();
            dataColumn.ColumnName = "Y";//设置第三列为在目标图层类作为分类标准的属性
            dataColumn.DataType   = System.Type.GetType("System.String");
            dataTable.Columns.Add(dataColumn);


            IGraphicsContainer pGraphicsContainer = axMapControl1.Map as IGraphicsContainer;
            DataRow            dataRow;

            for (int i = 0; i < pointCollection.PointCount; i++)
            {
                dataRow    = dataTable.NewRow();
                dataRow[0] = i;
                dataRow[1] = pointCollection.Point[i].X;
                dataRow[2] = pointCollection.Point[i].Y;//将统计结果添加到第三列
                dataTable.Rows.Add(dataRow);
                IMarkerElement pMarkerElement = new MarkerElementClass();
                IElement       pElement       = pMarkerElement as IElement;
                pElement.Geometry = pointCollection.Point[i];
                pGraphicsContainer.AddElement((IElement)pMarkerElement, 0);
            }
            axMapControl1.ActiveView.Refresh();

            DataBoard dataBoard = new DataBoard("Position", dataTable);

            dataBoard.Show();
        }
Example #43
0
        static void Main(string[] args)
        {
            string excelPath = AppDomain.CurrentDomain.BaseDirectory + "abc.xlsx";
            var conn = ExcelHelper.CreateConnection("abc.xlsx", ExcelHelper.ExcelVerion.Excel2007);
            conn.Open();
            var dt = ExcelHelper.GetWorkBookName(conn);

            //for (int i = 0; i < dt.Rows.Count; i++)
            //{
            //    for(int j=0;j<dt.Columns.Count;j++)
            //    {
            //        Console.Write("  " + dt.Rows[i][j].ToString() + "  ");
            //    }
            //}

            int lines = 0;
            var ds = ExcelHelper.ExecuteDataSet(conn, "SELECT * FROM  [Sheet2$]", null);
            for (int main = 0; main < ds.Tables.Count;main++ )
            {
                for (int i = 0; i < ds.Tables[main].Rows.Count; i++)
                {
                    for (int j = 0; j < ds.Tables[main].Columns.Count; j++)
                    {
                        Console.Write("  " + ds.Tables[main].Rows[i][j].ToString() + "  ");
                    }
                    Console.WriteLine("test:"+ds.Tables[main].Rows[i][1].ToString());
                    YiFuPriceType data = new YiFuPriceType();
                    data.YiFuName = ds.Tables[main].Rows[i][0].ToString();
                    data.Price = ds.Tables[main].Rows[i][1].ToString();
                    SqlConfig config = new SqlConfig(DataDriverType.Sqlite, "UCC_", "", "~db.db");
                    DataOperator dop = new DataOperator(config);
                    //var tmp = dop.SelectSingle(data) as YiFuPriceType;
                    YiFuPriceType tmp = null;
                    if (tmp == null)
                    {
                        data.YiFuPriceID = dop.Count<YiFuPriceType>().ToString();
                        data.YiFuName = ds.Tables[main].Rows[i][0].ToString();
                        data.Cat = ds.Tables[main].Rows[i][2].ToString();
                        data.IsZheKou = int.Parse(ds.Tables[main].Rows[i][3].ToString());
                        data.Price = ds.Tables[main].Rows[i][1].ToString();
                        dop.Insert<YiFuPriceType>(data);
                        dop.Commit();
                    }

                    lines++;
                    Console.WriteLine();

                }
            }

            Console.WriteLine("lines:" + lines);
            Console.ReadKey();
        }
Example #44
0
 private void LoadMonitorFreqInfos()
 {
     MonitorPlanInfo[] monitorPlans = DataOperator.GetMonitorFreqInfos(SystemLoginService.CurrentActivity.Guid, SystemLoginService.CurrentActivityPlace.Guid);
     if (monitorPlans == null || monitorPlans.Length == 0)
     {
         this.dataGridMonitorPlan.ItemsSource = new ObservableCollection <MonitorPlanInfo>();
     }
     else
     {
         this.dataGridMonitorPlan.ItemsSource = new ObservableCollection <MonitorPlanInfo>(monitorPlans);
     }
 }
Example #45
0
        private void ExcelImportBtn_Click(object sender, RoutedEventArgs e)
        {
            ORGAndEquipmentManage ctrl = new ORGAndEquipmentManage(SystemLoginService.CurrentActivityPlace);

            ctrl.Import();

            xDataGrid.ItemsSource = DataOperator.GetORGSource(new OrgQueryCondition()
            {
                ActivityGuid = SystemLoginService.CurrentActivity.Guid
            });
            //ExcelOperator.Import(ImportActivityEquipmentEvent);
        }
 public ActionResult Backup(string store, string name)
 {
     DataOperator dop = new DataOperator(config);
     BackUpInfo info = new BackUpInfo();
     info.BackUpID = Roo.Utils.StringBuilderHelper.GenerateStringID();
     info.BackUpTime = DateTime.Now;
     info.FileName = name;
     info.StoreName = store;
     dop.Insert(info);
     dop.Commit();
     OperateMessage m = new OperateMessage(true, "操作成功!");
     return Json(m, JsonRequestBehavior.AllowGet);
 }
 public ActionResult DoUpdate(string Tags)
 {
     DataOperator dop = new DataOperator(Runtime.SqlConfig);
     string[] array = Tags.Split(',');
     List<ArticleTag> list = new List<ArticleTag>();
     foreach(var item in array)
     {
         ArticleTag tag = new ArticleTag();
         tag.TagName = item;
         tag.TagTitle = item;
         if (dop.SelectSingle(tag) == null)
             dop.Update<ArticleTag>(tag);
     }
     return Redirect("/Admin/Success.do");
 }
        public static List<ArticleTag> GetArticleTags()
        {
            if (ArticleTags != null)
                return ArticleTags;

            List<ArticleTag> list = new List<ArticleTag>();
            DataOperator dop = new DataOperator(Runtime.SqlConfig);
            var result = dop.SelectAll(new ArticleTag());
            foreach(var item in result)
            {
                list.Add(item as ArticleTag);
            }
            ArticleTags = list;
            return list;
        }
 public ActionResult DoDelete(string categoryName)
 {
     DataOperator dop = new DataOperator(Runtime.SqlConfig);
     dop.Delete(categoryName);
     Article mArticle = new Article();
     mArticle.ACategoryName = categoryName;
     var list = dop.Select(mArticle, "", "", 10, 0);     //cms系统要改
     foreach(var item in list)
     {
         var article = item as Article;
         article.ACategoryName = "0";
         dop.Update(article);
     }
     TemplateDataHelper.Categories = null;
     return Redirect("/Admin/Success.do");
 }
        public ActionResult Manager(string key, string pageIndex)
        {
            ViewBag.Key = key;
            ViewBag.PageIndex = pageIndex;
            List<Article> list = new List<Article>();

            key = string.IsNullOrEmpty(key) ? "" : key;
            pageIndex = string.IsNullOrEmpty(pageIndex) ? "1" : pageIndex;

            DataOperator dop = new DataOperator(Runtime.SqlConfig);
            Article article = new Article();
            article.ATitle = key;
            list = dop.Select<Article>(article, "", "ATime DESC", 10, (int.Parse(pageIndex) - 1) * 10);

            return View(list);
        }
        public static List<Category> GetCategories()
        {
            if (Categories != null)
                return Categories;

            List<Category> list = new List<Category>();
            Category category = new Category();
            DataOperator dop = new DataOperator(Runtime.SqlConfig);
            var result = dop.Select(category, "CategoryName<>'recycle' and CategoryName<>'root'", "", 0, 0);
            foreach (var item in result)
            {
                list.Add(item as Category);
            }

            Categories = list;
            return list;
        }
        public ActionResult Message(ContactMessage m)
        {
            SqlConfig config = new SqlConfig(DataDriverType.Sqlite, "SoftWare_", "", "~/App_Data/db.db");
            DataOperator dop = new DataOperator(config);

            try
            {
                m.CMID = DateTime.Now.ToString("yyyyMMdd") + dop.Count<ContactMessage>();
                dop.Insert(m);
                dop.Commit();
                ViewBag.Message = "操作成功!我们的业务员会及时的联系您!";
            }
            catch
            {
                ViewBag.Message = "操作失败!试试换种方式和我们联系吧!";
            }
            return View();
        }
Example #53
0
        private void btnDataInit_Click(object sender, EventArgs e)
        {
            if (File.Exists(UccRuntime.SqlConfig.DataBasePath.Replace("~", AppDomain.CurrentDomain.BaseDirectory)))
            {
                for (int i = 0; i < 5; i++)
                {
                    if (MessageBox.Show("数据库已经存在,确定删除重新建立?", "数据库已经存在,确定删除重新建立?,这是一个不可以恢复的操作,操作完成后以前的数据将会丢失!", MessageBoxButtons.YesNo) == DialogResult.No)
                        return;
                }

            }
            File.Delete(UccRuntime.SqlConfig.DataBasePath.Replace("~", AppDomain.CurrentDomain.BaseDirectory));

            DataOperator dop = new DataOperator(UccRuntime.SqlConfig);

            dop.CreateTable<User>();
            dop.CreateTable<YiFu>();
            dop.CreateTable<ShouYi>();
            dop.CreateTable<MoneyHistory>();
        }
        //
        // GET: /Data/

        public ActionResult Index(string sql)
        {
            if(string.IsNullOrEmpty(sql))
            {
                ViewBag.Sql = "";
            }
            else
            {
                try
                {
                    DataOperator dop = new DataOperator(Runtime.SqlConfig);
                    dop.DataDriver.ExecuteNonQuery(sql);
                    ViewBag.Sql = sql;
                    ViewBag.Message = "操作成功!";
                }
                catch(Exception e)
                {
                    ViewBag.Message = e.Message;
                }
            }
            return View();
        }
Example #55
0
        static UccRuntime()
        {
            string dataDir = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "/CleanerData/";
            if (!Directory.Exists(dataDir))
                Directory.CreateDirectory(dataDir);
            if (!File.Exists(dataDir + "db.db") && File.Exists(AppDomain.CurrentDomain.BaseDirectory + "db.db"))
                File.Copy(AppDomain.CurrentDomain.BaseDirectory + "db.db", dataDir + "db.db");

            SqlConfig = new SqlConfig(DataDriverType.Sqlite, "UCC_", "", dataDir + "db.db");
            Dop = new DataOperator(SqlConfig);
            string path = AppDomain.CurrentDomain.BaseDirectory + "store.json";
            if (!File.Exists(path))
            {
                StoreInfo = new StoreInfo();
                StoreInfo.Name = "美国UCC国际洗衣";
                StoreInfo.PhoneNo = "13761561263";
                StoreInfo.Address = "闵行区金平路19号近鹤庆路";
                File.WriteAllText(path, Roo.Data.DataConverter.RenderJson(Roo.Data.DataConverter.ObjectToJson(StoreInfo)), Encoding.Default);
            }
            else
            {
                StoreInfo = DataConverter.JsonToObject<StoreInfo>(File.ReadAllText(path, Encoding.Default));
            }
        }
Example #56
0
        private void btnKaiDan_Click(object sender, EventArgs e)
        {
            try
            {
                foreach(var item in GetYiFuList())
                {
                    foreach(var tempItem in GetYiFuList())
                    {
                        if (tempItem != item && item.ClotheID == tempItem.ClotheID)
                        {
                            MessageBox.Show("衣服里面有重复的衣服单号!请检查一下!衣服单号:" + item.ClotheID);
                            return;
                        }
                    }
                }
                DataOperator dop = new DataOperator(UccRuntime.SqlConfig);

                if (Ticket == null)
                    Ticket = new ShouYi();
                Ticket.TicketID = this.txtTicketID.Text;
                var temp = dop.SelectSingle(Ticket) as ShouYi;
                if (temp != null)
                {
                    MessageBox.Show("此单号已经开过!请重新开单!");
                    return;
                }

                Ticket.UserID = this.txtUserID.Text;
                Ticket.UserName = this.txtUserName.Text;
                Ticket.PhoneNo = this.txtPhone.Text;
                Ticket.Address = this.txtAddress.Text;
                Ticket.PutWay = this.cbxPutWay.SelectedItem.ToString();
                Ticket.Price = this.txtThisMoney.Text;
                Ticket.State = "未洗";
                Ticket.MoneyState = this.cbxMoneyState.Text;
                Ticket.ShouYiDateTime = DateTime.Parse(this.datePutIn.Text);
                Ticket.QuYiDateTime = DateTime.Parse(this.datePutOut.Text);
                Ticket.ZheKou = double.Parse(this.cbxZheKou.Text);
                dop.Insert(Ticket);

                for (int i = 0; i < this.YiFuList.Count; i++)
                {
                    var item = this.YiFuList[i];
                    item.ClotheID = item.TicketID + "-" + (i + 1);
                    dop.Insert(item);
                }
                dop.Commit();
                MessageBox.Show("操作成功!");
            }
            catch (Exception ex)
            {
                MessageBox.Show("操作失败!" + ex.Message + ex.StackTrace);
            }
        }
Example #57
0
    public static DataOperator GetInstance () {
			if (_instance == null) {
				_instance = new DataOperator ();
			}
        return _instance;
    }
Example #58
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            string path = UccRuntime.SqlConfig.DataBasePath.Replace("~", AppDomain.CurrentDomain.BaseDirectory);
            if (File.Exists(path))
                File.Delete(path);
            DataOperator dop = new DataOperator(UccRuntime.SqlConfig);

            dop.CreateTable<User>();
            dop.CreateTable<YiFu>();
            dop.CreateTable<ShouYi>();
            dop.CreateTable<MoneyHistory>();

            dop.CreateTable<XiaCi>();
            dop.CreateTable<YanSe>();
            dop.CreateTable<PinPai>();
            dop.CreateTable<YiFuPriceType>();
            dop.CreateTable<ChongZhiType>();

            dop.Commit();

            //xiace
            var table= SimpleDataController.Get(AppDomain.CurrentDomain.BaseDirectory + "/data/clothes_error.txt");
            for(int i=0;i<table.Rows.Count;i++)
            {
                XiaCi item = new XiaCi();
                item.XiaCiID = dop.Count<XiaCi>().ToString();
                item.XiaCiContent = table.Rows[i][1].ToString();
                dop.Insert(item);
                dop.Commit();
            }
            table = SimpleDataController.Get(AppDomain.CurrentDomain.BaseDirectory + "/data/clothes_color.txt");
            for(int i=0;i<table.Rows.Count;i++)
            {
                YanSe item = new YanSe();
                item.YanSeID = dop.Count<YanSe>().ToString();
                item.YanSeName = table.Rows[i][1].ToString();
                dop.Insert(item);
                dop.Commit();
            }
            table = SimpleDataController.Get(AppDomain.CurrentDomain.BaseDirectory + "/data/clothes_pinpai.txt");
            for(int i=0;i<table.Rows.Count;i++)
            {
                PinPai item = new PinPai();
                item.PinPaiID = dop.Count<PinPai>().ToString();
                item.PinPaiName = table.Rows[i][0].ToString();
                dop.Insert(item);
                dop.Commit();
            }
            table = SimpleDataController.Get(AppDomain.CurrentDomain.BaseDirectory + "/data/clothes.txt");
            for (int i = 0; i < table.Rows.Count; i++)
            {
                YiFuPriceType item = new YiFuPriceType();
                item.YiFuPriceID = dop.Count<YiFuPriceType>().ToString();
                item.YiFuName = table.Rows[i][1].ToString();
                item.DanWei = table.Rows[i][2].ToString();
                item.Price = table.Rows[i][3].ToString();
                dop.Insert(item);
                dop.Commit();
            }
            table = SimpleDataController.Get(AppDomain.CurrentDomain.BaseDirectory + "/data/register_money.txt");
            for (int i = 0; i < table.Rows.Count; i++)
            {
                ChongZhiType item = new ChongZhiType();
                item.ChonZhiMoney = double.Parse(table.Rows[i][0].ToString());
                item.ZengSongMoney = double.Parse(table.Rows[i][1].ToString());
                dop.Insert(item);
                dop.Commit();
            }
            dop.Commit();
            MessageBox.Show("操作成功!");
        }
 public static Category GetCategory(string categoryName)
 {
     DataOperator dop = new DataOperator(Runtime.SqlConfig);
     Category category = new Category();
     category.CategoryName = categoryName;
     category = dop.SelectSingle(category) as Category;
     return category;
 }
 public static List<Article> GetCategoryArticles(string categoryName)
 {
     List<Article> list = new List<Article>();
     DataOperator dop = new DataOperator(Runtime.SqlConfig);
     var result = dop.Select<Article>(new Article(), "ACategoryName='" + categoryName + "'", "ATime DESC", 10, 0);
     foreach (var item in result)
     {
         list.Add(item);
     }
     return list;
 }