Ejemplo n.º 1
0
        /// <summary>
        /// 保存一条MACRang的记录数据(update)
        /// </summary>
        /// <param name="Object"></param>
        /// <returns></returns>
        public void UpdateMACRange(MACRangeDef obj, String oldMACRangeId)
        {
            try
            {
                INumControlRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<INumControlRepository>();

                UnitOfWork uow = new UnitOfWork();
                MACRange item = itemRepository.GetMACRange(Int32.Parse(obj.id));
                //if (item.Status != "R" && (item.BegNo != obj.BegNo || item.EndNo != obj.EndNo))
                //{
                //    List<string> erpara = new List<string>();
                //    FisException ex;
                //    ex = new FisException("MDT001", erpara);
                //    throw ex;
                //}

                item.Code= obj.Code;
                item.BegNo=obj.BegNo;
                item.EndNo=obj.EndNo;
                //item.Status=obj.Status;
                item.Editor=obj.Editor;
                item.Udt= DateTime.Now;

                itemRepository.UpdateMACRange(item);
                uow.Commit();
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 保存一条MACRang的记录数据(Add)
        /// </summary>
        /// <param name="Object"></param>
        /// <returns></returns>
        public string AddMACRange(MACRangeDef obj)
        {
            //MACRangeDef MACRangeObj = obj;
            try
            {
                INumControlRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<INumControlRepository>();

                //UnitOfWork uow = new UnitOfWork();
                MACRange item = new MACRange(
                    0,
                    obj.Code,
                    obj.BegNo,
                    obj.EndNo,
                    obj.Status,
                    obj.Editor,
                    DateTime.Now,
                    DateTime.Now
                    );
                itemRepository.AddMACRange(item);

                return item.ID.ToString();
                //uow.Commit();
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 取得MACRange List列表(按“Code”列的字母序排序)
        /// </summary>
        /// <returns></returns>
        public IList<MACRangeDef> GetMACRangeList()
        {
            //List<MACRangeDef> result = new List<MACRangeDef>();
            //MACRangeDef item1 = new MACRangeDef();
            //item1.id = 1;
            //item1.BegNo = "BeginNo1";
            //item1.EndNo = "EndNo1";
            //item1.Editor = "aa";
            //item1.Code = "Code1";
            //item1.Status = "R";
            //item1.StatusText = "Created";
            //result.Add(item1);

            //MACRangeDef item2 = new MACRangeDef();
            //item2.id = 2;
            //item2.BegNo = "BeginNo2";
            //item2.EndNo = "EndNo2";
            //item2.Editor = "aa";
            //item2.Code = "code2";
            //item2.Status = "A";
            //item2.StatusText = "Active";
            //result.Add(item2);

            //MACRangeDef item3 = new MACRangeDef();
            //item3.id = 3;
            //item3.BegNo = "BeginNo3";
            //item3.EndNo = "EndNo3";
            //item3.Editor = "aa";
            //item3.Code = "code3";
            //item3.Status = "C";
            //item3.StatusText = "Closed";
            //result.Add(item3);

            ////R:Created; A:Active; C:Closed  CmbMacRangeStatus

            //return result;

            List<MACRangeDef> retLst = new List<MACRangeDef>();
            try
            {
                INumControlRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<INumControlRepository>();
                IList<MACRange> result = itemRepository.GetMACRangeList();
                for (int i = 0; i < result.Count; i++)
                {
                    MACRangeDef item = new MACRangeDef();
                    item.BegNo = result[i].BegNo;
                    item.EndNo = result[i].EndNo;
                    item.Code = result[i].Code;
                    item.Editor = result[i].Editor;
                    item.id = result[i].ID.ToString();
                    item.Status = result[i].Status;
                    if (item.Status == MACRANGE_STATUS_R)
                    {
                        item.StatusText = MACRANGE_STATUS_R_TEXT;
                    }
                    else if (item.Status == MACRANGE_STATUS_A)
                    {
                        item.StatusText = MACRANGE_STATUS_A_TEXT;
                    }
                    else
                    {
                        item.StatusText = MACRANGE_STATUS_C_TEXT;
                    }

                    //item.Udt = result[i].Udt.ToString("yyyy-MM-dd");
                    //item.Cdt = result[i].Cdt.ToString("yyyy-MM-dd");


                    if (result[i].Cdt == DateTime.MinValue)
                    {
                        item.Cdt = "";
                    }
                    else
                    {
                        item.Cdt = ((System.DateTime)result[i].Cdt).ToString("yyyy-MM-dd HH:mm:ss");
                    }

                    if (result[i].Udt == DateTime.MinValue)
                    {
                        item.Udt = "";
                    }
                    else
                    {
                        item.Udt = ((System.DateTime)result[i].Udt).ToString("yyyy-MM-dd HH:mm:ss");
                    }

                    retLst.Add(item);

                }
                return retLst;
            }
            catch (Exception)
            {
                throw;
            }

        }
Ejemplo n.º 4
0
        /// <summary>
        /// 取得一条MACRang的记录数据
        /// </summary>
        /// <param name="?"></param>
        /// <returns></returns>
        public MACRangeDef GetMACRange(String id)
        {
            //MACRangeDef item2 = new MACRangeDef();
            //item2.id = "1";
            //item2.BegNo = "BeginNo2";
            //item2.EndNo = "EndNo2";
            //item2.Editor = "aa";
            //item2.Code = "Code2";
            //item2.Status = "s2";
           
            //return item2;

            MACRangeDef ret = new MACRangeDef();
            try
            {
                INumControlRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<INumControlRepository>();
                MACRange item = itemRepository.GetMACRange(Int32.Parse(id));
                ret.BegNo = item.BegNo;
                ret.Code = item.Code;
                ret.Editor = item.Editor;
                ret.EndNo = item.EndNo;
                ret.id = item.ID.ToString();
                ret.Status = item.Status;
                
                return ret;
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 5
0
    protected void btnAdd_ServerClick(Object sender, EventArgs e)
    {
        MACRangeDef item = new MACRangeDef();
        item.Code = this.dCode.Text.Trim().ToUpper();
        item.BegNo = this.dBeginNo.Text.Trim().ToUpper();
        item.EndNo = this.dEndNo.Text.Trim().ToUpper();
        item.Editor = this.HiddenUserName.Value;
        //item.Status = this.cmbMacRangeStatus.InnerDropDownList.SelectedItem.Value;//SelectedValue;
        //item.StatusText = this.cmbMacRangeStatus.InnerDropDownList.SelectedItem.Text;

        item.Status = Resources.ComboxFixValues.ResourceManager.GetString(Pre + "_CmbMacRangeStatusItemValue1");
        item.StatusText = Resources.ComboxFixValues.ResourceManager.GetString(Pre + "_CmbMacRangeStatusItemText1");        

        string newId;
        try
        {
            newId = iMACRange.AddMACRange(item);
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            return;
        }
        catch (Exception ex)
        {
            //show error
            showErrorMessage(ex.Message);
            return;
        }
        ShowMACRangeList();
        this.updatePanel1.Update();
        ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "AddUpdateComplete('" + newId + "');DealHideWait();", true);
    }