Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string  strDormAreaID = Request.Params["DormAreaID"];
            string  strBuildingID = Request.Params["BuildingID"];
            string  strID         = Request.Params["ID"];
            string  strUnitName   = Request.Params["UnitName"];
            int     intID;
            UnitBLL mUnitBLL = new UnitBLL();

            Int32.TryParse(strID, out intID);
            TB_Unit mTB_DormArea = new TB_Unit()
            {
                Creator    = (base.UserInfo == null ? base.SystemAdminInfo.Account : base.UserInfo.ADAccount),
                UpdateBy   = (base.UserInfo == null?base.SystemAdminInfo.Account:base.UserInfo.ADAccount),
                ID         = intID,
                BuildingID = Convert.ToInt32(strBuildingID),
                DormAreaID = Convert.ToInt32(strDormAreaID),
                SiteID     = (base.UserInfo == null?base.SystemAdminInfo.SiteID:base.UserInfo.SiteID),
                Name       = strUnitName.Trim(),
            };

            mUnitBLL.Edit(mTB_DormArea);
            Response.Write(mUnitBLL.ErrMessage);
            mUnitBLL.ErrMessage = string.Empty;
            Response.End();
        }
Beispiel #2
0
        /// <summary>
        /// delete Data from Database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        #region Delete Record
        protected void IsObsolete_CheckedChanged(Object sender, EventArgs e)
        {
            string message = string.Empty;

            try
            {
                CheckBox    chk = (CheckBox)sender;
                GridViewRow gr  = (GridViewRow)chk.Parent.Parent;

                string unitID = ((Literal)gr.FindControl("litUnitID")).Text;
                objUnitBLL = new UnitBLL();

                message = objUnitBLL.ObsoleteUnit(Convert.ToInt32(unitID), Convert.ToString(chk.Checked));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                }
                ClearDetails();
                BindGrid(false, true);
                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #3
0
        public void start(SCApplication app)
        {
            vehicleBLL          = app.VehicleBLL;
            vehicleService      = app.VehicleService;
            segmentBLL          = app.SegmentBLL;
            addressesBLL        = app.AddressesBLL;
            guideBLL            = app.GuideBLL;
            cmdBLL              = app.CMDBLL;
            unitBLL             = app.UnitBLL;
            commObjCacheManager = app.getCommObjCacheManager();
            var vhs = app.getEQObjCacheManager().getAllVehicle();

            lineService = app.LineService;
            foreach (AVEHICLE vh in vhs)
            {
                vh.CommandComplete       += Vh_CommandComplete;
                vh.BatteryLevelChange    += Vh_BatteryLevelChange;
                vh.BatteryCapacityChange += Vh_BatteryCapacityChange;
            }

            //註冊各個Coupler的Status變化,在有其中一個有變化的時候要通知AGV目前所有coupler的狀態
            List <AUNIT> chargers = unitBLL.OperateCatch.loadUnits();

            foreach (AUNIT charger in chargers)
            {
                //charger.CouplerStatusChanged += Charger_CouplerStatusChanged;
                charger.CouplerHPSafetyChaged += Charger_CouplerHPSafetyChaged;
            }
        }
        public async Task <IActionResult> Edit([Bind("UnitCode,UnitName,UnitDesc,Id,Is_Active,Created_Date,Created_By,Updated_Date,Updated_By")] M_Unit m_Unit)
        {
            if (ModelState.IsValid)
            {
                m_Unit.Updated_By = await base.CurrentUserId();

                ResultObject resultObj;

                try
                {
                    using (var unitBll = new UnitBLL())
                    {
                        resultObj = await unitBll.UpdateUnit(m_Unit);

                        _cache.Remove("CACHE_MASTER_UNIT");
                    }

                    return(Json(new { success = true, data = (M_Unit)resultObj.ObjectValue, message = "Unit Update." }));
                }
                catch (Exception ex)
                {
                    return(Json(new { success = false, data = m_Unit, message = ex.Message }));
                }
            }

            var err = ModelState.Values.SelectMany(x => x.Errors).Select(x => x.ErrorMessage).ToList();

            return(Json(new { success = false, errors = err, data = m_Unit, message = "Update Failed" }));
        }
 public frmUnit()
 {
     unitBll    = new UnitBLL(dbHelper);
     productBLL = new ProductBLL(dbHelper);
     InitializeComponent();
     dataGridView1.CellContentClick += dataGridView1_CellContentClick;
 }
        public async Task <IActionResult> GetUnit()
        {
            try
            {
                if (_cache.TryGetValue("CACHE_MASTER_UNIT", out List <M_Unit> c_lstUnit))
                {
                    return(Json(new { data = c_lstUnit }));
                }

                MemoryCacheEntryOptions options = new MemoryCacheEntryOptions
                {
                    AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(300),
                    SlidingExpiration = TimeSpan.FromSeconds(60),
                    Priority          = CacheItemPriority.NeverRemove
                };

                using (var unitBll = new UnitBLL())
                {
                    var lstUnit = await unitBll.GetUnit(null);

                    _cache.Set("CACHE_MASTER_UNIT", lstUnit, options);

                    return(Json(new { data = lstUnit }));
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(new { success = false, message = ex.Message }));
            }

            //using (var unitBll = new UnitBLL())
            //{
            //    return Json(new { data = await unitBll.GetUnit(null) });
            //}
        }
Beispiel #7
0
        private void LoadData(int id)
        {
            var src = new UnitBLL().GetUnits(new SearchCriteria()
            {
                StringParams = new List <string>()
                {
                    ""
                }
            }, id, companyId);

            if (src != null && src.Count() > 0)
            {
                var unit = src.FirstOrDefault();
                txtUnit.Text = unit.UnitName;
                //txtPrefix.Text = unit.Prefix;
                //rdoStatus.SelectedIndex = unit.UnitStatus?0:1;
                if (unit.UnitType == "NA")
                {
                    rdoStatus.SelectedIndex = 0;
                }
                else
                {
                    rdoStatus.SelectedIndex = 1;
                }
            }
        }
        public void CanViewPositionsFilteredBySchool()
        {
            string schoolCode = "02";

            var positions = PositionBLL.GetByStatusAndDepartment(Closed, AdminAccepted, AllowApplications, null, schoolCode); //controller.ViewPositions("School", schoolCode) as ViewResult;

            Assert.IsNotNull(positions);
            Assert.AreEqual(4, positions.Count);

            foreach (var position in positions)
            {
                bool hasSchool = false;

                foreach (var dept in position.Departments)
                {
                    var unit = UnitBLL.GetByID(dept.DepartmentFIS);

                    if (unit.SchoolCode == schoolCode)
                    {
                        hasSchool = true;
                    }
                }

                Assert.IsTrue(hasSchool, string.Format("Position {0} is not in school {1}", position.ID, schoolCode));
            }
        }
Beispiel #9
0
        private static void LoadUser()
        {
            //Let's put a user for testing
            var user = new User {
                FirstName = "Test", LastName = "User", LoginIDs = new List <Login>()
            };
            var userLogin = new Login()
            {
                User = user
            };

            EntityIdSetter.SetIdOf <string>(userLogin, "tester");

            user.LoginIDs.Add(userLogin);

            //Now associate this person with some units
            user.Units = new List <Unit>();

            var apls = UnitBLL.GetByID("APLS");
            var chem = UnitBLL.GetByID("CHEM");

            user.Units.Add(apls);
            user.Units.Add(chem);

            UserBLL.EnsurePersistent(user, true);
            GenericBLL <Login, string> .EnsurePersistent(userLogin, true);
        }
Beispiel #10
0
        public bool IsWork(UnitBLL unitBLL)
        {
            if (DebugParameter.isPassCouplerStatus)
            {
                LogHelper.Log(logger: logger, LogLevel: LogLevel.Info, Class: nameof(AADDRESS), Device: "AGVC",
                              Data: $"pass coupler status,flag:{DebugParameter.isPassCouplerStatus}");
                return(true);
            }

            //return true;
            AUNIT charger = unitBLL.OperateCatch.getUnit(ChargerID);

            if (charger != null)
            {
                switch (CouplerNum)
                {
                case CouplerNum.NumberOne:
                    return(charger.Coupler1Status == SCAppConstants.CouplerStatus.Auto ||
                           charger.Coupler1Status == SCAppConstants.CouplerStatus.Charging);

                case CouplerNum.NumberTwo:
                    return(charger.Coupler1Status == SCAppConstants.CouplerStatus.Auto ||
                           charger.Coupler1Status == SCAppConstants.CouplerStatus.Charging);

                case CouplerNum.NumberThree:
                    return(charger.Coupler1Status == SCAppConstants.CouplerStatus.Auto ||
                           charger.Coupler1Status == SCAppConstants.CouplerStatus.Charging);
                }
            }
            return(false);
        }
        public async Task <IActionResult> DeleteConfirmed(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            ResultObject resultObj;

            try
            {
                if (_cache.TryGetValue("CACHE_MASTER_UNIT", out List <M_Unit> c_lstUnit))
                {
                    var m_Unit = c_lstUnit.Find(u => u.Id == id);

                    if (m_Unit == null)
                    {
                        return(NotFound());
                    }

                    m_Unit.Updated_By = await base.CurrentUserId();

                    using (var unitBll = new UnitBLL())
                    {
                        resultObj = await unitBll.DeleteUnit(m_Unit);

                        _cache.Remove("CACHE_MASTER_UNIT");
                    }

                    return(Json(new { success = true, data = (M_Unit)resultObj.ObjectValue, message = "Unit Deleted." }));
                }

                using (var unitBll = new UnitBLL())
                {
                    var lstUnit = await unitBll.GetUnit(id);

                    var m_Unit = lstUnit.First();

                    if (m_Unit == null)
                    {
                        return(NotFound());
                    }

                    m_Unit.Updated_By = await base.CurrentUserId();

                    resultObj = await unitBll.DeleteUnit(m_Unit);

                    _cache.Remove("CACHE_MASTER_UNIT");
                }

                return(Json(new { success = true, data = (M_Unit)resultObj.ObjectValue, message = "Unit Deleted." }));
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, message = ex.Message }));
            }
        }
Beispiel #12
0
        /// <summary>
        /// To bind details to dropdownlist
        /// </summary>
        private void Getunitofmeasure()
        {
            UnitBLL BLLobj = new UnitBLL();

            ddlUnitOfmeasure.DataSource     = BLLobj.GetUnit();
            ddlUnitOfmeasure.DataTextField  = "UnitName";
            ddlUnitOfmeasure.DataValueField = "UnitID";
            ddlUnitOfmeasure.DataBind();
        }
Beispiel #13
0
 /// <summary>
 /// SET DATA TO Dropdown ddlMeasure
 /// </summary>
 private void BindUnitRightWay()
 {
     objUnitBLL                = new UnitBLL();
     objUnitList               = objUnitBLL.GetUnit();
     ddlMeasure.DataSource     = objUnitList;
     ddlMeasure.DataTextField  = "UnitName";
     ddlMeasure.DataValueField = "UnitID";
     ddlMeasure.DataBind();
 }
        public void BindUnit()
        {
            DataTable dtItemUnit = UnitBLL.GetUnit();

            ddUnit.DataSource     = dtItemUnit;
            ddUnit.DataTextField  = "Description";
            ddUnit.DataValueField = "ID";
            ddUnit.DataBind();
        }
Beispiel #15
0
        /// <summary>
        /// Save and Update Data into Database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        #region Save Record
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string message      = string.Empty;
            string AlertMessage = string.Empty;

            objUnit    = new UnitBO();
            objUnitBLL = new UnitBLL();

            //Assignement
            objUnit.UnitName = txtUnit.Text.Trim();

            if (ViewState["UnitID"] != null)
            {
                objUnit.UnitID = Convert.ToInt32(ViewState["UnitID"].ToString());
            }

            objUnit.IsDeleted = "False";

            //if (Session["USER_ID"] != null)
            objUnit.CreatedBy = Convert.ToInt32(Session["USER_ID"].ToString());

            if (objUnit.UnitID < 1)
            {
                //If UnitID does Not exists then SaveUnit
                objUnit.UnitID = -1;//For New Unit
                message        = objUnitBLL.AddUnit(objUnit);
                AlertMessage   = "alert('" + message + "');";

                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data saved successfully";
                    ClearDetails();
                    BindGrid(true, false);
                }
            }
            else
            {
                //If UnitID exists then UpdateUnit
                message = objUnitBLL.UpdateUnit(objUnit); //For Updating Unit

                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                    ClearDetails();
                    BindGrid(true, false);
                }
            }

            if (message != "")
            {
                AlertMessage = "alert('" + message + "');";
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true);
            }

            SetUpdateMode(false);
        }
Beispiel #16
0
        /// <summary>
        /// Set Grid Data source
        /// </summary>
        /// <param name="addRow"></param>
        /// <param name="deleteRow"></param>
        #region Load Grid / Bind Grid
        private void BindGrid(bool addRow, bool deleteRow)
        {
            objUnitBLL = new UnitBLL();
            objUnit    = new UnitBO();

            objUnit.UnitName = string.Empty;
            objUnit.UnitID   = 0;

            grdUnit.DataSource = objUnitBLL.GetAllUnit();//(objUnit);
            grdUnit.DataBind();
        }
        public List <UnitJson> GetAllUnitJson()
        {
            var result = new List <UnitJson>();

            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                UnitBLL _UnitBLL = new UnitBLL();
                result           = _UnitBLL.GetAllUnit();
            });
            return(result);
        }
Beispiel #18
0
        public async Task <ActionResult> ModifyUnit([FromBody] UnitDTO unit)
        {
            if (UnitExists(unit.UnitID))
            {
                // Call BLL Unit Modify method with all the parameters
                object BLLResponse = new UnitBLL(_context).ModifyUnitBLL(unit: unit);

                if (BLLResponse.GetType().BaseType == typeof(Exception))
                {
                    // Create log entries for Debug log
                    ((APIException)BLLResponse).Exceptions.ForEach(ex => Logger.Msg <UnitsController>((Exception)ex, Serilog.Events.LogEventLevel.Debug));

                    // Return response from API
                    return(BadRequest(new { errors = ((APIException)BLLResponse).Exceptions.Select(x => x.Message).ToArray() }));
                }
                else
                {
                    try
                    {
                        UnitDTO modUnit = (UnitDTO)BLLResponse;

                        // Find the existing record based on ID
                        Unit currentRecord = _context.Units.Where(x => x.UnitID == modUnit.UnitID).First();

                        // Modify the record
                        currentRecord.Description = modUnit.Description;

                        // Save changes
                        await _context.SaveChangesAsync();

                        Logger.Msg <UnitsController>($"[{User.FindFirstValue("email")}] [MODIFY] UnitID: {currentRecord.UnitID} successful", Serilog.Events.LogEventLevel.Information);

                        // Return modified record as a DTO
                        UnitDTO response = new UnitDTO(currentRecord);
                        return(Ok(response));
                    }
                    catch (Exception ex)
                    {
                        // Local log entry. Database reconciliation issues are more serious so reported as Error
                        Logger.Msg <UnitsController>($"[MODIFY] Database sync error {ex.Message}", Serilog.Events.LogEventLevel.Error);

                        // Return response to client
                        return(StatusCode(500, new { errors = "Database update failed. Contact the administrator to resolve this issue." }));
                    }
                }
            }
            else
            {
                return(NotFound());
            }
        } // End of ModifyUnit
Beispiel #19
0
        private void SaveUnit()
        {
            var result = new UnitBLL().AddEditUnit(ExtractData(), companyId, Mode);

            if (result > 0)
            {
                UnitId = result;
                Response.Redirect("~/Forwarding/Master/ManageUnits.aspx");
            }
            else
            {
                GeneralFunctions.RegisterAlertScript(this, "Error Occured");
            }
        }
Beispiel #20
0
        private static void LoadDepartments()
        {
            string[] fiscodes = { "AANS", "ADNO", "APLS", "CHEM" };
            string[] schools  = { "01", "01", "02", "03" };

            for (int i = 0; i < 4; i++)
            {
                var unit = new Unit(fiscodes[i])
                {
                    FullName = "Animal Science", SchoolCode = schools[i]
                };

                UnitBLL.EnsurePersistent(unit, true);
            }
        }
Beispiel #21
0
        /// <summary>
        /// edit Data into Database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        #region Edit Record
        private void GetUnitDetails()
        {
            objUnitBLL = new UnitBLL();
            int UnitID = 0;

            if (ViewState["UnitID"] != null)
            {
                UnitID = Convert.ToInt32(ViewState["UnitID"].ToString());
            }

            objUnit = new UnitBO();
            objUnit = objUnitBLL.GetUnitById(UnitID);

            txtUnit.Text = objUnit.UnitName;
        }
Beispiel #22
0
        private void DataBindDepartments()
        {
            List <CAESDO.Recruitment.Core.Domain.Unit> units = new List <CAESDO.Recruitment.Core.Domain.Unit>();

            if (Roles.IsUserInRole("Admin"))
            {
                units = UnitBLL.GetAll("ShortName", true);
            }
            else
            {
                User u = UserBLL.GetByLogin(User.Identity.Name);

                units = new List <CAESDO.Recruitment.Core.Domain.Unit>(u.Units);
            }

            dlistDepartment.DataSource = units;
            dlistDepartment.DataBind();
        }
Beispiel #23
0
        private void DeleteUnit(string unitID)
        {
            objUnitBLL = new UnitBLL();
            string message = string.Empty;

            message = objUnitBLL.DeleteUnit(Convert.ToInt32(unitID));
            if (string.IsNullOrEmpty(message) || message == "" || message == "null")
            {
                message = "Data Deleted successfully";
            }

            ClearDetails();
            BindGrid(false, true);
            if (message != "")
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
            }
        }
        protected void lbtnAddDepartment_Click(object sender, EventArgs e)
        {
            CAESDO.Recruitment.Core.Domain.Unit selectedUnit = UnitBLL.GetByID(dlistDepartment.SelectedValue);

            Department associatedDepartment = new Department();

            associatedDepartment.AssociatedPosition = currentPosition;
            associatedDepartment.DepartmentFIS      = selectedUnit.ID;
            associatedDepartment.Unit        = selectedUnit;
            associatedDepartment.PrimaryDept = DepartmentList.Count == 0;

            if (DepartmentList.Contains(associatedDepartment) == false)
            {
                DepartmentList.Add(associatedDepartment);
            }

            gviewDepartments.DataSource = DepartmentList;
            gviewDepartments.DataBind();
        }
Beispiel #25
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         this.ddlBind();
         string  strID = Request.QueryString["id"];
         int     intID;
         TB_Unit mTB_Unit = null;
         UnitBLL mUnitBLL = new UnitBLL();
         if (Int32.TryParse(strID, out intID))
         {
             mTB_Unit = mUnitBLL.Get(intID);
             this.txtUnitName.Text = mTB_Unit.Name;
             this.ddlDormAreaName.SelectedValue = mTB_Unit.DormAreaID.ToString();
             this.BindDDLBuilding(mTB_Unit.DormAreaID);
             this.ddlBuildingName.SelectedValue = mTB_Unit.BuildingID.ToString();
         }
     }
 }
Beispiel #26
0
        public void start(SCApplication app)
        {
            vehicleBLL          = app.VehicleBLL;
            vehicleService      = app.VehicleService;
            segmentBLL          = app.SegmentBLL;
            addressesBLL        = app.AddressesBLL;
            guideBLL            = app.GuideBLL;
            cmdBLL              = app.CMDBLL;
            unitBLL             = app.UnitBLL;
            commObjCacheManager = app.getCommObjCacheManager();
            var vhs = app.getEQObjCacheManager().getAllVehicle();

            foreach (AVEHICLE vh in vhs)
            {
                vh.CommandComplete       += Vh_CommandComplete;
                vh.BatteryLevelChange    += Vh_BatteryLevelChange;
                vh.BatteryCapacityChange += Vh_BatteryCapacityChange;
            }
        }
Beispiel #27
0
        public async Task <ActionResult> AddUnit(string description)
        {
            // Call BLL Unit Add method with all the parameters
            object BLLResponse = new UnitBLL(_context).AddUnitBLL(description: description);

            if (BLLResponse.GetType().BaseType == typeof(Exception))
            {
                // Create log entries for Debug log
                ((APIException)BLLResponse).Exceptions.ForEach(ex => Logger.Msg <UnitsController>((Exception)ex, Serilog.Events.LogEventLevel.Debug));

                // Return response from API
                return(BadRequest(new { errors = ((APIException)BLLResponse).Exceptions.Select(x => x.Message).ToArray() }));
            }
            else
            {
                try
                {
                    Unit newUnit = new Unit {
                        Description = ((UnitDTO)BLLResponse).Description
                    };

                    // Create the record
                    _context.Units.Add(newUnit);
                    await _context.SaveChangesAsync();

                    Logger.Msg <UnitsController>($"[{User.FindFirstValue("email")}] [ADD] Unit '{description}' successful", Serilog.Events.LogEventLevel.Information);

                    // Convert back to DTO and return to user
                    UnitDTO response = new UnitDTO(newUnit);
                    return(Ok(response));
                }
                catch (Exception ex)
                {
                    // Local log entry. Database reconciliation issues are more serious so reported as Error
                    Logger.Msg <UnitsController>($"[ADD] Database sync error {ex.Message}", Serilog.Events.LogEventLevel.Error);

                    // Return response to client
                    return(StatusCode(500, new { errors = "Database update failed. Contact the administrator to resolve this issue." }));
                }
            }
        } // End of AddUnit
Beispiel #28
0
        /// <summary>
        /// GridView绑定
        /// </summary>
        /// <param name="intCurrentIndex"></param>
        private void Bind(int intCurrentIndex)
        {
            TB_Unit mTB_Unit = new TB_Unit();
            UnitBLL mUnitBLL = new UnitBLL();
            Pager   pager    = new Pager();

            pager.CurrentPageIndex = intCurrentIndex;
            pager.srcOrder         = "  ID desc";

            mTB_Unit.SiteID      = (base.UserInfo == null ? base.SystemAdminInfo.SiteID : base.UserInfo.SiteID);
            mTB_Unit.Name        = this.txtUnitName.Text;
            mTB_Unit.DormAreaID  = Convert.ToInt32(this.ddlDormArea.SelectedValue);
            mTB_Unit.BuildingID  = Convert.ToInt32(Request.Form[this.ddlBuildingName.UniqueID.ToString()]);
            GridView1.DataSource = mUnitBLL.GetTable(mTB_Unit, ref pager);
            GridView1.DataBind();

            this.Pager1.ItemCount    = pager.TotalRecord;
            this.Pager1.PageCount    = pager.TotalPage;
            this.Pager1.CurrentIndex = pager.CurrentPageIndex;
            this.Pager1.PageSize     = pager.PageSize;
        }
        // GET: Master/Unit/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            try
            {
                if (_cache.TryGetValue("CACHE_MASTER_UNIT", out List <M_Unit> c_lstUnit))
                {
                    var m_Unit = c_lstUnit.Find(u => u.Id == id);

                    if (m_Unit == null)
                    {
                        return(NotFound());
                    }

                    return(PartialView(m_Unit));
                }

                using (var unitBll = new UnitBLL())
                {
                    var lstUnit = await unitBll.GetUnit(id);

                    var m_Unit = lstUnit.First();

                    if (m_Unit == null)
                    {
                        return(NotFound());
                    }

                    return(PartialView(m_Unit));
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(new { success = false, message = ex.Message }));
            }
        }
Beispiel #30
0
        /// <summary>
        /// To bind data to Drop down ddlUnit
        /// </summary>
        private void BindUnit()
        {
            objUnitBLL  = new UnitBLL();
            objUnitList = objUnitBLL.GetUnit();
            ddlUnit.Items.Clear();
            ListItem lst;

            if (objUnitList.Count > 0)
            {
                ddlUnit.DataSource     = objUnitList;
                ddlUnit.DataTextField  = "UnitName";
                ddlUnit.DataValueField = "UnitID";
                ddlUnit.DataBind();
                lst = new ListItem("--Select--", "0");
                ddlUnit.Items.Insert(0, lst);
            }
            else
            {
                lst = new ListItem("--Select--", "0");
                ddlUnit.Items.Insert(0, lst);
            }
        }