Пример #1
0
        /// <summary>Save the Log while deleting mapping
        /// <CreatedFor>For Insert QRC Type</CreatedFor>
        /// <CreatedBy>Vijay sahu</CreatedBy>
        /// <CreatedOn>march-11-2015</CreatedOn>
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public ServiceDARModel UserLocationMappingDelete(ServiceDARModel obj, string locationname, string userType)
        {
            ObjUserRepository = new UserRepository();
            objDARRepository  = new DARRepository();
            try
            {
                string createdByName = "";
                if (obj.LocationId > 0)
                {
                    using (workorderEMSEntities objContext = new workorderEMSEntities())
                    {
                        obj.UserName = (from o in objContext.UserRegistrations
                                        where o.UserId == obj.UserId && o.IsDeleted == false
                                        select o.FirstName + "" + o.LastName).FirstOrDefault();


                        createdByName = (from o in objContext.UserRegistrations
                                         where o.UserId == obj.CreatedBy && o.IsDeleted == false
                                         select o.FirstName + "" + o.LastName).FirstOrDefault();
                    }



                    obj.ActivityDetails = DarMessage.DeleteLocationMapping(obj.UserName, locationname, userType, createdByName); // this will generate an message
                    var result = objDARRepository.SaveDARDetails(obj);
                    if (result != null || result > 0)
                    {
                        obj.Response        = Convert.ToInt32(ServiceResponse.SuccessResponse, CultureInfo.CurrentCulture);
                        obj.DARId           = result;
                        obj.ResponseMessage = CommonMessage.SaveSuccessMessage();
                    }
                    else
                    {
                        obj.Response        = Convert.ToInt32(ServiceResponse.ExeptionResponse, CultureInfo.CurrentCulture);
                        obj.DARId           = result;
                        obj.ResponseMessage = CommonMessage.WrongParameterMessage();
                    }
                }
                else
                {
                    obj.Response        = Convert.ToInt32(ServiceResponse.FailedResponse, CultureInfo.CurrentCulture);
                    obj.ResponseMessage = CommonMessage.WrongParameterMessage();
                }
            }
            catch (Exception ex)
            {
                Exception_B.Exception_B.exceptionHandel_Runtime(ex, "public ServiceDARModel UserLocationMappingDelete(ServiceDARModel obj, string locationname, string userType)", "Exception While creating location", obj);
                throw ex;
            }
            return(obj);
        }