public HttpResponseMessage Save(ContractorAccess model)
        {
            HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.Created);

            try
            {
                model.CurUserAdSid = GetCurUser().Sid;
                model.Save();
                response.Content = new StringContent(String.Format("{{\"id\":{0}}}", model.Id));
            }
            catch (Exception ex)
            {
                response = new HttpResponseMessage(HttpStatusCode.OK);
                response.Content = new StringContent(MessageHelper.ConfigureExceptionMessage(ex));

            }
            return response;
        }
Beispiel #2
0
        public static void Close(int id, string deleterSid)
        {
            var ctrAcc = new ContractorAccess(id);
            SqlParameter pId = new SqlParameter() { ParameterName = "id", SqlValue = id, SqlDbType = SqlDbType.Int };
            SqlParameter pDeleterSid = new SqlParameter() { ParameterName = "deleter_sid", SqlValue = deleterSid, SqlDbType = SqlDbType.VarChar };
            var dt = Db.Service.ExecuteQueryStoredProcedure("close_contractor_access", pId, pDeleterSid);

            AdHelper.ExcludeUserFromAdGroup(ctrAcc.AdSid, ctrAcc.OrgSid);
            AdHelper.ExcludeUserFromAdGroup(ctrAcc.AdSid, AdGroup.ZipClaimAddressChange, AdGroup.ServiceEngeneer);
        }
 public ContractorAccess Get(int id)
 {
     var model = new ContractorAccess(id);
     return model;
 }
Beispiel #4
0
        public static IEnumerable<ContractorAccess> GetList()
        {
            var dt = Db.Service.ExecuteQueryStoredProcedure("get_contractor_access");

            var lst = new List<ContractorAccess>();

            foreach (DataRow row in dt.Rows)
            {
                var model = new ContractorAccess(row);
                lst.Add(model);
            }

            return lst;
        }