示例#1
0
 public UCJH_weekman() {
     InitializeComponent();
     initImageList();
     gridViewOperation = new GridViewOperation<JH_weekman>(gridControl1, gridView1, barManager1,new frmJH_weekmanEdit());
     
     gridViewOperation.CreatingObjectEvent +=gridViewOperation_CreatingObjectEvent;
     gridView1.FocusedRowChanged += gridView1_FocusedRowChanged;
     //btEdit.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
     gridViewOperation.BeforeDelete += new ObjectOperationEventHandler<JH_weekman>(gridViewOperation_BeforeDelete);
     gridViewOperation.BeforeAdd += new ObjectOperationEventHandler<JH_weekman>(gridViewOperation_BeforeAdd);
     gridView1.IndicatorWidth = 40;//设置显示行号的列宽
     gridView1.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView1_CustomDrawRowIndicator);
     
     //treeList1.FocusedNodeChanged += new DevExpress.XtraTreeList.FocusedNodeChangedEventHandler(treeList1_FocusedNodeChanged);
     //treeList1.OptionsBehavior.Editable = false;
     //treeList1.OptionsSelection.EnableAppearanceFocusedCell = true;
     //treeList1.OptionsSelection.InvertSelection = true;
     org = MainHelper.UserOrg;
     //splitContainerControl1.PanelVisibility = SplitPanelVisibility.Panel2;
     gridViewOperation.AfterAdd += new ObjectEventHandler<JH_weekman>(gridViewOperation_AfterAdd);
     gridViewOperation.BeforeEdit += new ObjectOperationEventHandler<JH_weekman>(gridViewOperation_BeforeEdit);
     gridViewOperation.AfterDelete += new ObjectEventHandler<JH_weekman>(gridViewOperation_AfterDelete);
     createcontrol();
     btExport.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
     btExport1.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
     //btExport1.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
     bar3.Visible = false;
     
 }
示例#2
0
        public UCSharpeNetwork(string gdscode) {

            InitializeComponent();
            if (gdscode == "all")
                _gds = new mOrg() { OrgCode = gdscode, OrgName = "全局配电线路网络图" };
            else
                _gds = ClientHelper.PlatformSqlMap.GetOne<mOrg>("where orgcode='" + gdscode + "'");
            InitTree();
            createCheckGroup();
        }
示例#3
0
 /// <summary>
 /// 初始化数据
 /// </summary>
 public void InitData() {
     if (this.Site!=null &&this.Site.DesignMode) return;//必要的,否则设计时可能会报错
     //需要初始化数据时在这写代码
     mOrg org = ClientHelper.PlatformSqlMap.GetOneByKey<mOrg>("200");
     if (org == null) {
         org = new mOrg() { OrgCode = "200", OrgID = "200", OrgType = "0", OrgName = "供电所" };
         ClientHelper.PlatformSqlMap.Create<mOrg>(org);
     }
     RefreshData(" where parentid='200'");
     gridView1.BestFitColumns();
 }
示例#4
0
        void btGDS_EditValueChanged(object sender, EventArgs e) {
            parentID = btGdsList.EditValue.ToString();
            InitData();
            IList<mOrg> list = Client.ClientHelper.PlatformSqlMap.GetList<mOrg>("where orgcode='" + btGdsList.EditValue + "'");
            mOrg org = null;
            if (list.Count > 0)
                org = list[0];

            if (org != null) {
                parentObj = org;
                IList<sd_xl> xlList = Client.ClientHelper.PlatformSqlMap.GetListByWhere<sd_xl>(" where  OrgCode='" + org.OrgCode + "'");
                repositoryItemLookUpEdit2.DataSource = xlList;
            }
        }
示例#5
0
        protected override void OnShown(EventArgs e) {
            base.OnShown(e);
            mUser user = ClientHelper.PlatformSqlMap.GetOne<mUser>("where loginid='rabbit'");
            if (user == null) {
                string uid="rabbit";
                string pwd="JpHEL7rrwh0TMCL7QWcYWQ==";
                user = new mUser() { LoginID = uid, UserName = uid, UserID = uid, OrgCode="999", Password = pwd, Valid=true };
                rUserRole role = new rUserRole() { RoleID = "20110721102714952375", UserID = uid };
                mOrg org = new mOrg() { OrgID = "999", OrgCode = "999", OrgName = "超级管理员" };

                ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(new object[] {org, user, role }, null, null);

                org = ClientHelper.PlatformSqlMap.GetOneByKey<mOrg>("200");
                if (org == null) {
                    org = new mOrg() { OrgCode = "200", OrgID = "200", OrgType = "0", OrgName = "供电所" };
                    ClientHelper.PlatformSqlMap.Create<mOrg>(org);
                }
                org = ClientHelper.PlatformSqlMap.GetOneByKey<mOrg>("300");
                if (org == null) {
                    org = new mOrg() { OrgCode = "300", OrgID = "300", OrgType = "0", OrgName = "变电所" };
                    ClientHelper.PlatformSqlMap.Create<mOrg>(org);
                }
            }
        }
示例#6
0
        void btGdsList_EditValueChanged(object sender, EventArgs e) {
            IList<mOrg> list = Client.ClientHelper.PlatformSqlMap.GetList<mOrg>("where orgcode='" + btGdsList.EditValue + "'");
            _mOrg = null;
            if (list.Count > 0)
                _mOrg = list[0];

            frm.LineCode = string.Empty;
            if (_mOrg != null) {
                frm.GdsCode = _mOrg.OrgCode;
                IList<PS_xl> xlList = Client.ClientHelper.PlatformSqlMap.GetListByWhere<PS_xl>(" where OrgCode='" + _mOrg.OrgCode + "' and  linevol='10'");
                
                xlselector.DataSource = Ebada.Core.ConvertHelper.ToDataTable((IList)xlList, typeof(PS_xl)); 
                xlselector.SetColumnsVisible("LineName");
                xlselector.SetFilterColumns("xlpy");
            }
        }
示例#7
0
        private static   bool  HasSYdata( mOrg userorg)
        {
            bool result = false;
            int index = 0;
            string sql = string.Empty;
            if (userorg != null)
            {
                sql = " where OrgID='" + userorg.OrgCode + "'";
            }
            IList<PS_aqgj> aqgjlist = ClientHelper.PlatformSqlMap.GetList<PS_aqgj>(sql);

            foreach (PS_aqgj aqgj in aqgjlist)
            {
                index++;
                string sqlsy = " where sbID='" + aqgj.sbID + "' order by xcsyrq desc";
                IList<PJ_14aqgjsy> aqgjsylist = ClientHelper.PlatformSqlMap.GetList<PJ_14aqgjsy>(sqlsy);
                if (aqgjsylist.Count > 0 && aqgjsylist[0].xcsyrq > DateTime.Now)
                {
                    result = true;
                    break;

                }
            }
            return result;

        }
示例#8
0
        public static bool IsNeedTX( mOrg userorg)
        {
            //找到所有启用的提醒设置
            bool result=false;
            List<WarnRecord> list = new List<WarnRecord>();

            string sqlwarn = "where IsUse=1";
            
            IList<WarnSet> wslist = MainHelper.PlatformSqlMap.GetList<WarnSet>(sqlwarn);

            DateTime dtnow = DateTime.Now;
            int index = 0;
            foreach (WarnSet ws in wslist)
            {
                //如果此提醒设置对该单位不起作用,则不用计算

                if (userorg != null && !ws.BYScol1.Contains(userorg.OrgCode))
                {
                    break;
                }
                index++;
                string tablename = ws.TableName;
                string field = ws.FieldName;
                string orgfield = ws.OrgField;
                string sql = string.Empty;
                sql = "  select top(1) " + field + " from " + tablename;
                if (orgfield != string.Empty && userorg != null)
                {
                    sql += "  where " + orgfield + " ='" + userorg.OrgCode + "'";
                }
                sql += " order by cast(" + field + "  as datetime)  desc";

                DateTime lastneeddate = new DateTime();
                int needtimes = 0;



                try
                {
                    //查找符合条件的日期最后值

                    object dt = MainHelper.PlatformSqlMap.GetObject("GetWarnResultBySqlWhere", sql);
                    DateTime resdt = DateTime.Parse(dt.ToString());
                    //每月类型
                    if (ws.WarnType == frmWarnSetEdit.WarinType1)
                    {
                        if (IsNeedWarnMonth1(ws.BeforeDays, ws.OrderDays, ws.AfterDays, resdt, out lastneeddate, out needtimes))
                        {

                            result = true;
                            return result;
                        }
                    }
                    else
                    {
                        if (IsNeedWarnDays1(ws.BeforeDays, ws.SpaceDays, ws.AfterDays, resdt, out lastneeddate, out needtimes))
                        {
                            result = true;
                            return result;
                           

                        }
                    }

                }
                catch (Exception)
                {
                    break;
                }

            }
            
            if (!result)
            {
                result = HasSYdata(userorg);
            }

            return result;
        }
示例#9
0
        void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e) {
            org = treeList1.GetDataRecordByNode(e.Node) as mOrg;
            if (org != null && org.OrgCode == "0") org = null;

            ParentID = parentID;
        }
示例#10
0
        JH_yearks createjh(mOrg o,JH_yearks s) {
            JH_yearks jh = new JH_yearks();
            ConvertHelper.CopyTo(s, jh);
            jh.ID = jh.CreateID();
            jh.单位代码 = o.OrgCode;
            jh.单位名称 = o.OrgName;
            jh.c2 = s.ID;
            jh.单位分类 = "9";//下发任务

            return jh;
        }
示例#11
0
 public static string CreatWorkFolwNo(mOrg org, string parentID)
 {
     return CreatWorkFolwNo(org, parentID, "");
 }
示例#12
0
        public UCJH_monthks(bool all) {
            InitializeComponent();
            initImageList();
            gridViewOperation = new GridViewOperation<JH_monthks>(gridControl1, gridView1, barManager1);

            gridViewOperation.CreatingObjectEvent += gridViewOperation_CreatingObjectEvent;
            gridView1.FocusedRowChanged += gridView1_FocusedRowChanged;
            //btEdit.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
            gridViewOperation.BeforeDelete += new ObjectOperationEventHandler<JH_monthks>(gridViewOperation_BeforeDelete);
            gridViewOperation.BeforeAdd += new ObjectOperationEventHandler<JH_monthks>(gridViewOperation_BeforeAdd);
            barEditItem1.EditValueChanged += new EventHandler(barEditItem1_EditValueChanged);
            gridView1.IndicatorWidth = 40;//设置显示行号的列宽
            gridView1.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView1_CustomDrawRowIndicator);
            treeList1.FocusedNodeChanged += new DevExpress.XtraTreeList.FocusedNodeChangedEventHandler(treeList1_FocusedNodeChanged);
            treeList1.OptionsBehavior.Editable = false;
            treeList1.OptionsSelection.EnableAppearanceFocusedCell = true;
            treeList1.OptionsSelection.InvertSelection = true;
            org = MainHelper.UserOrg;
            //splitContainerControl1.PanelVisibility = SplitPanelVisibility.Panel2;
            gridViewOperation.AfterAdd += new ObjectEventHandler<JH_monthks>(gridViewOperation_AfterAdd);
            gridViewOperation.BeforeEdit += new ObjectOperationEventHandler<JH_monthks>(gridViewOperation_BeforeEdit);
            //全局 = all;
            selected = true;

            gridControl1.DoubleClick += new EventHandler(gridControl1_DoubleClick);
            bar1.Visible = false;
            bar3.Visible = false;
            splitContainerControl1.PanelVisibility = SplitPanelVisibility.Panel2;
            btJZ.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
        }
示例#13
0
        //清空标记
        private void DelJL(mOrg org)
        {
            if (!ReadOnly)
            {
                string sqlupdate = " s1=''  where OrgCode='" + org.OrgCode + "'";
                MainHelper.PlatformSqlMap.Update("UpdatePJ_qxflByWhwer", sqlupdate);
            }

        }
示例#14
0
 /// <summary>
 /// 新建对象设置Key值
 /// </summary>
 /// <param name="newobj"></param>
 void gridViewOperation_CreatingObjectEvent(mOrg newobj) {
     newobj.OrgType = "2";
     newobj.ParentID = "300";
 }
示例#15
0
        JH_weekman createjh(mOrg o,JH_weekman s) {
            JH_weekman jh = new JH_weekman();
            ConvertHelper.CopyTo(s, jh);
            jh.ID = jh.CreateID();
            jh.单位代码 = o.OrgCode;
            jh.单位名称 = o.OrgName;
            jh.c2 = s.ID;

            return jh;
        }
示例#16
0
 /// <summary>
 /// 设置显示的所,可控制数据范围只显示单个所,在load前设置才会生效
 /// </summary>
 /// <returns></returns>
 public void SetShowOrg(mOrg org) {
     m_org = org;
 }
示例#17
0
        void btGdsList_EditValueChanged(object sender, EventArgs e)
        {
            IList<mOrg> list = Client.ClientHelper.PlatformSqlMap.GetList<mOrg>("where orgcode='" + barGDS.EditValue + "'");
            mOrg org = null;
            if (list.Count > 0)
                org = list[0];

            if (org != null)
            {
                ParentObj = org;
                if (SelectGdsChanged != null)
                    SelectGdsChanged(this, org);
            }

            GetWpmc();
        }
示例#18
0
        public static string CreatWorkFolwNo(mOrg org, string parentID, string kind)
        {
            string number = "";
            IList<WF_TableFieldValueView> datalist = null;
            IList<LP_Record> datalist2 = null;
            Regex r1 = new Regex(@"[0-9]+$");
            switch (kind)
            {
                case "编号规则一":
                    if (r1.Match(parentID).Value == "")
                    {
                        datalist2 = Client.ClientHelper.PlatformSqlMap.GetListByWhere<LP_Record>(
                   " where  Kind='" + parentID + "' and Number like '%" + org.OrgCode.Substring(org.OrgCode.Length - 2) + "-%' order by Number desc");
                        if (datalist2.Count > 0)
                        {
                            string stri = datalist2[0].Number.Substring(datalist2[0].Number.Length - 3);
                            number = org.OrgCode.Substring(org.OrgCode.Length - 2) + string.Format("-{0:D3}", Convert.ToInt32(stri) + 1);
                        }
                        else
                        {

                            number = org.OrgCode.Substring(org.OrgCode.Length - 2) + "-001";
                        }
                    }
                    else
                    {
                        datalist = Client.ClientHelper.PlatformSqlMap.GetListByWhere<WF_TableFieldValueView>(
                   " where FieldName='编号' and UserControlId='" + parentID + "' and ControlValue like '%" + org.OrgCode.Substring(org.OrgCode.Length - 2) + "-%' order by Number desc");
                        if (datalist.Count > 0)
                        {
                            string stri = datalist[0].Number.Substring(datalist[0].Number.Length - 3);
                            number = org.OrgCode.Substring(org.OrgCode.Length - 2) + string.Format("-{0:D3}", Convert.ToInt32(stri) + 1);
                        }
                        else
                        {

                            number = org.OrgCode.Substring(org.OrgCode.Length - 2) + "-001";
                        }
                    }

                    break;
                default:
                    //if (r1.Match(parentID).Value == "")
                    //{
                    object objnum = Client.ClientHelper.PlatformSqlMap.GetObject("SelectOneStr",
                        " select top 1 number from LP_Record where  Kind='" + kind + "' and Number like '" +
                        DateTime.Now.ToString("yyyyMMdd") + org.OrgCode + "%' and len(number)=15 order by Number desc");

                    if (objnum != null && objnum.ToString().Length > 0)
                    {
                        string stri = objnum.ToString().Substring(objnum.ToString().Length - 3);
                        number = DateTime.Now.ToString("yyyyMMdd") + org.OrgCode + string.Format("{0:D4}", Convert.ToInt32(stri) + 1);
                    }
                    else
                    {

                        number = DateTime.Now.ToString("yyyyMMdd") + org.OrgCode + "0001";
                    }
                    //}
                    //else
                    //{
                    //    datalist = Client.ClientHelper.PlatformSqlMap.GetListByWhere<WF_TableFieldValueView>(
                    //         " where FieldName='编号' and UserControlId='" + parentID + "' and ControlValue like '%" +
                    //         DateTime.Now.ToString("yyyyMMdd") + org.OrgCode + "%' order by Number desc");

                    //    if (datalist.Count > 0)
                    //    {
                    //        string stri = datalist[0].Number.Substring(datalist[0].Number.Length - 3);
                    //        number = DateTime.Now.ToString("yyyyMMdd") + org.OrgCode + string.Format("{0:D4}", Convert.ToInt32(stri) + 1);
                    //    }
                    //    else
                    //    {

                    //        number = DateTime.Now.ToString("yyyyMMdd") + org.OrgCode + "0001";
                    //    }
                    //}

                    break;
            }
            return number;
        }
示例#19
0
        void btGdsList_EditValueChanged(object sender, EventArgs e)
        {
            IList<mOrg> list = Client.ClientHelper.PlatformSqlMap.GetList<mOrg>("where orgcode='" + btGdsList.EditValue + "'");
            mOrg org=null;
            if (list.Count > 0)
                org = list[0];
           
            if (org != null)
            {
                RefreshData(" where tqID in(select tqID from PS_tq where LEFT(tqID,'" + org.OrgCode.Length + "')='" + org.OrgCode + "') or orgCode='" + org.OrgCode + "' order by sbCode ");
                ParentObj = org;
                gds = org;
                IList<PS_xl> xlList = Client.ClientHelper.PlatformSqlMap.GetListByWhere<PS_xl>(" where OrgCode='" + org.OrgCode + "'");
                repositoryItemLookUpEdit3.DataSource = xlList;
            }
            

        }
示例#20
0
 void treeViewOperator_CreatingObject(mOrg newobj) {
     newobj.OrgType = "0";
 }
示例#21
0
 void treeViewOperator_AfterDelete(mOrg newobj) {
     if (AfterDelete != null)
         AfterDelete(treeList1, newobj);
 }
示例#22
0
 internal void SetShowOrg(mOrg mOrg) {
     gridViewOperation.BindingList.Clear();
     gridViewOperation.BindingList.Add(mOrg);
 }
示例#23
0
 void treeViewOperator_AfterAdd(mOrg newobj) {
     if (AfterAdd != null)
         AfterAdd(treeList1, newobj);
 }
示例#24
0
 void btGDS_EditValueChanged(object sender, EventArgs e)
 {
     parentID = btGdsList.EditValue.ToString();
     
     IList<mOrg> list = Client.ClientHelper.PlatformSqlMap.GetList<mOrg>("where orgcode='" + btGdsList.EditValue + "'");
     mOrg org = null;
     if (list.Count > 0)
         org = list[0];
     parentObj = org;
     InitData();
    
 }
示例#25
0
        void btGdsList_EditValueChanged(object sender, EventArgs e)
        {
            IList<mOrg> list = Client.ClientHelper.PlatformSqlMap.GetList<mOrg>("where orgcode='" + btGdsList.EditValue + "'");
            _mOrg = null;
            if (list.Count > 0)
                _mOrg = list[0];

//             frm.LineCode = string.Empty;
            if (_mOrg != null)
            {
                //frm.GdsCode = _mOrg.OrgCode;               
                ParentID = _mOrg.OrgCode;                           
            }
            

        }