public Hashtable GpsCarFilterToHashTable(int int_0) { SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@workId", int_0) }; DataTable table = new SqlDataAccess().getDataBySP("WebGpsClient_GetCarFilter", parameterArray); Hashtable hashtable = new Hashtable(); if (hashtable.Count > 0) { hashtable.Clear(); } CarFilterInfo info = null; foreach (DataRow row in table.Rows) { if (row["simNum"] != DBNull.Value) { info = new CarFilterInfo { SimNum = Convert.ToString(row["simNum"]), CarInfoData = CarDataInfoBuffer.GetDataCarInfoBySimNum(info.SimNum) }; if (info.CarInfoData != null) { info.PosReadTime = info.CarInfoData.IsNewPosTime; info.PicReadTime = info.CarInfoData.IsNewPicTime; hashtable.Add(info.SimNum, info); } } } return hashtable; }
public int DeletePathAlarm(string string_0) { string format = "delete from GpsCarPathParam where carID ={0}"; format = string.Format(format, string_0); SqlDataAccess access = new SqlDataAccess(); return access.updateBySql(format); }
public DataTable Car_AddPassWayPathIdToTmp(string string_0, int int_0, int int_1, string string_1, string string_2, int int_2) { SqlDataAccess access = new SqlDataAccess(); string str = "AppSvr_UpdateGpsCarPassageWayParam_tmp"; SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@WrkID", int_0), new SqlParameter("@OrderID", int_1), new SqlParameter("@carID", string_0), new SqlParameter("@PathID", string_1), new SqlParameter("@PassWayID", string_2), new SqlParameter("@Speed", int_2) }; return access.getDataBySP(str, parameterArray); }
public DataTable GetAlarmPathDotFromGisCar(string string_0) { string format = " select AlarmPathDot from GisCarInfoTable where carID={0}"; format = string.Format(format, string_0); SqlDataAccess access = new SqlDataAccess(); return access.getDataBySql(format); }
public int DeleteRegionAlarm(string string_0, int int_0) { string format = "delete from GpsCarRegionParam where carID ={0} and regionFeature = {1}"; format = string.Format(format, string_0, int_0); SqlDataAccess access = new SqlDataAccess(); return access.updateBySql(format); }
public DataTable GetCarAlarmRegionInfo(string string_0) { string format = "select RegionDot, regionFeature from GisCarInfoTable where CarId={0}"; format = string.Format(format, string_0); SqlDataAccess access = new SqlDataAccess(); return access.getDataBySql(format); }
public DataTable GetCaptureMoniterDataByCarId(string string_0) { string format = "select * from GpsCarCaptureParam where carId = {0}"; format = string.Format(format, string_0); SqlDataAccess access = new SqlDataAccess(); return access.getDataBySql(format); }
public static int InsertAlarmResult(TrafficALarmHandle trafficALarmHandle_0) { string format = "insert into GpsJTBAlarmProc values('{0}','{1}',getdate(),{2},{3},'{4}','{5}')"; format = string.Format(format, new object[] { trafficALarmHandle_0.CarId, trafficALarmHandle_0.GpsTime, trafficALarmHandle_0.WorkID, trafficALarmHandle_0.OrderID, trafficALarmHandle_0.ProcMode, trafficALarmHandle_0.Remark }); SqlDataAccess access = new SqlDataAccess(); return access.insertBySql(format); }
public OnlineUserInfo(int int_3, string string_3, int int_4, int int_5, bool bool_3, bool bool_4, bool bool_5, string string_4, string string_5) { DateTime time; DateTime time2; DateTime time3; this.dateTime_5 = DateTime.Now; this.int_0 = -1; this.string_0 = ""; this.string_1 = ""; this.string_2 = string.Empty; this.carFilter_0 = new Bussiness.CarFilter(); this.downCommand_0 = new DownCommand(); this.userCarId_0 = new Bussiness.UserCarId(string_3); this.WorkId = int_3; this.UserId = string_3; this.ModuleId = int_5; this.AllowSelMutil = bool_3; this.AllowEmptyPw = bool_4; this.SudoOverDue = bool_5; this.GroupId = int_4; this.RoadTransportID = string_4; this.AreaCode = string_5; this.NewAlarmTime = time = new SqlDataAccess().getSystemDate(); this.NewLogTime = time2 = time; this.NewLogIOTime = time3 = time2; this.NewOtherDataTime = this.NewPicTime = time3; }
public int DelPath(int int_0, string string_0) { string str = "AppSvr_DelPath"; SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@pathID", int_0), new SqlParameter("@pathName", string_0) }; SqlDataAccess access = new SqlDataAccess(); return access.updateBySp(str, parameterArray); }
public int DelRegion(string string_0) { string str = "AppSvr_DelRegion"; SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@regionName", string_0) }; SqlDataAccess access = new SqlDataAccess(); return access.updateBySp(str, parameterArray); }
public bool DelRegionCheckAuth(string string_0, string string_1) { string format = " SELECT A.regionID, A.regionName FROM gpsRegionType A,GpsPathInGroup B,GpsPathGroupAuth C WHERE C.USERID='{0}' and A.regionName='{1}' and c.AUTH&2<>0 AND B.REGIONID IS NOT NULL AND c.pathgroupID=b.pathgroupID AND A.REGIONID=B.REGIONID "; format = string.Format(format, string_1, string_0); DataTable table = new SqlDataAccess().getDataBySql(format); return ((table != null) && (table.Rows.Count > 0)); }
public DataTable GetPathSegmentInfo(string string_0) { string format = "select PathSegmentName,e.PathID,PathSegmentID,alarmSegmentDot from GpsPathSegment e inner join (SELECT DISTINCT A.PathID FROM gpsPathType A,GpsPathInGroup B,GpsPathGroupAuth C WHERE C.USERID='{0}' AND (c.AUTH&1<>0 or c.AUTH&2<>0) AND B.PathID IS NOT NULL AND c.pathgroupID=b.pathgroupID AND A.PathID=B.PathID) d on e.PathID=d.PathID "; SqlDataAccess access = new SqlDataAccess(); format = string.Format(format, string_0); return access.getDataBySql(format); }
public BoxEntry(IView view) { if (view == null) throw new ArgumentNullException("view"); this.view = view; dataAccess = new SqlDataAccess(ConfigurationManager.ConnectionStrings["DbConnection"].ConnectionString); }
public DataTable GetPathInfo(string string_0) { string format = @"SELECT D.*,E.AlarmPathDot,(case when E.pathtype=0 then '' else SUBSTRING(E.regioninfo,0,CHARINDEX('\1*',E.regionInfo)) end) as factoryName,(case when E.pathtype=0 then '' else SUBSTRING(E.regioninfo,CHARINDEX('\1*',E.regionInfo)+3,CHARINDEX('\4*',E.regionInfo)-CHARINDEX('\1*',E.regionInfo)-3) end) as buildingSitName,(case when E.pathtype=0 then '' else SUBSTRING(E.regioninfo,CHARINDEX('\4*',E.regionInfo)+3,len(E.regioninfo)-CHARINDEX('\4*',E.regionInfo)-2) end) as region_Radius FROM (SELECT DISTINCT A.PathID, A.PathName,A.Remark,B.pathgroupID,A.pathType FROM gpsPathType A,GpsPathInGroup B,GpsPathGroupAuth C WHERE C.USERID='{0}' AND (c.AUTH&1<>0 or c.AUTH&2<>0) AND B.PathID IS NOT NULL AND c.pathgroupID=b.pathgroupID AND A.PathID=B.PathID) D,gpsPathType E WHERE D.PathID=E.PathID ORDER BY D.PathID desc "; format = @"SELECT D.*,E.AlarmPathDot, (SELECT RegionName FROM GpsRegionType Where Convert(Varchar,RegionID)=(case when E.pathtype=0 then '' else SUBSTRING(E.regioninfo,0,CHARINDEX('\1*',E.regionInfo)) end)) as factoryName, (SELECT RegionName FROM GpsRegionType Where Convert(Varchar,RegionID)=(case when E.pathtype=0 then '' else SUBSTRING(E.regioninfo,CHARINDEX('\1*',E.regionInfo)+3,CHARINDEX('\4*',E.regionInfo)-CHARINDEX('\1*',E.regionInfo)-3) end)) as buildingSitName,(case when E.pathtype=0 then '' else SUBSTRING(E.regioninfo,CHARINDEX('\4*',E.regionInfo)+3,len(E.regioninfo)-CHARINDEX('\4*',E.regionInfo)-2) end) as region_Radius FROM (SELECT DISTINCT A.PathID, A.PathName,A.Remark,B.pathgroupID,A.pathType FROM gpsPathType A,GpsPathInGroup B,GpsPathGroupAuth C WHERE C.USERID='{0}' AND (c.AUTH&1<>0 or c.AUTH&2<>0) AND B.PathID IS NOT NULL AND c.pathgroupID=b.pathgroupID AND A.PathID=B.PathID) D,gpsPathType E WHERE D.PathID=E.PathID ORDER BY D.PathID desc "; SqlDataAccess access = new SqlDataAccess(); format = string.Format(format, string_0); return access.getDataBySql(format); }
public void Setup() { _browserAccess = new BrowserAccess(); _driver = _browserAccess.Driver; _baseUrl = _browserAccess.BaseUrl; _salesForceCustomerId = null; _sqlDataAccess = new SqlDataAccess(); _restaurantPage = new RestaurantPage(_driver); }
private void method_0() { Trace.Write("appserver - Thread upNewPosition, WebGpsClient_GetCurrentPosData start!"); DataRow row = UpdataStruct.CloneDataTableColumn.NewRow(); SqlDataAccess access = new SqlDataAccess(); DateTime dbTime = base.GetDbTime(access); Label_0019: try { SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@ReadTime", dbTime) }; DataTable table = access.getDataBySP("WebGpsClient_GetCurrentPosData", parameterArray); if (table != null) { goto Label_0056; } Label_004A: Thread.Sleep(0x7d0); goto Label_0019; Label_0056: if (table.Rows.Count <= 0) { goto Label_004A; } dbTime = Convert.ToDateTime(table.Rows[0]["svrTime"]); string str = string.Empty; string str2 = string.Empty; CarInfo dataCarInfoBySimNum = null; CarPartInfo info2 = new CarPartInfo(); foreach (DataRow row2 in table.Rows) { this.method_1(row2, row, info2); str = Convert.ToString(row2["phone"]); str2 = Convert.ToString(row2["carNum"]); dataCarInfoBySimNum = CarDataInfoBuffer.GetDataCarInfoBySimNum(str); if (((dataCarInfoBySimNum != null) && !string.IsNullOrEmpty(str2)) && !str2.Equals(dataCarInfoBySimNum.CarNum)) { CarDataInfoBuffer.GetDataCarInfoByCarNum(str2); } if (dataCarInfoBySimNum != null) { dataCarInfoBySimNum.CarPosData = row.ItemArray; dataCarInfoBySimNum.IsNewPosTime = dbTime; } } Thread.Sleep(20); goto Label_0019; } catch (Exception exception) { Thread.Sleep(0xbb8); LogHelper helper = new LogHelper(); ErrorMsg msg = new ErrorMsg("UpdataNewPosition", helper.GetCallFunction(), helper.GetExceptionMsg(exception)); helper.WriteError(msg); goto Label_0019; } }
public int GetNewId(string string_0) { string str = "select NewID from GpsModule where id=" + string_0; DataTable table = new SqlDataAccess().getDataBySql(str); if ((table != null) && (table.Rows.Count > 0)) { return int.Parse(table.Rows[0][0].ToString()); } return -1; }
public int GetOilBoxVol(string string_0) { string str = "select OilBoxVol from GpsOilBoxType where id in"; str = str + "(select OilBoxTypeId from giscar where carid = " + string_0 + ")"; DataTable table = new SqlDataAccess().getDataBySql(str); if (table.Rows.Count > 0) { return int.Parse(table.Rows[0]["OilBoxVol"].ToString()); } return 0; }
private string method_0(string string_2, string string_3) { string format = "select a.pathName from GpsPathType a left join GpsCarPathParam b on a.pathid = b.pathid where b.newpathid = {0} and b.carid = {1}"; format = string.Format(format, string_3, string_2); DataTable table = new SqlDataAccess().getDataBySql(format); if ((table != null) && (table.Rows.Count > 0)) { return table.Rows[0]["pathName"].ToString(); } return string.Empty; }
public bool DelPathCheckAuth(int int_0, string string_0, string string_1) { string format = " SELECT A.PathID, A.PathName FROM gpsPathType A,GpsPathInGroup B,GpsPathGroupAuth C WHERE C.USERID='{0}' AND c.AUTH&2<>0 AND B.PathID IS NOT NULL AND c.pathgroupID=b.pathgroupID AND A.PathID=B.PathID AND A.PathID='{1}' "; format = string.Format(format, string_1, int_0); if (int_0 == -1) { format = " SELECT A.PathID, A.PathName FROM gpsPathType A,GpsPathInGroup B,GpsPathGroupAuth C WHERE C.USERID='{0}' AND c.AUTH&2<>0 AND B.PathID IS NOT NULL AND c.pathgroupID=b.pathgroupID AND A.PathID=B.PathID AND A.PathName='{1}' "; format = string.Format(format, string_1, string_0); } DataTable table = new SqlDataAccess().getDataBySql(format); return ((table != null) && (table.Rows.Count > 0)); }
public DataTable GetAreaInfoAllEx() { DataTable table; SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@UserId", this.UserId) }; try { table = new SqlDataAccess().getDataBySP("WebGpsClient_GetAreaInfoAll", parameterArray); } catch (Exception exception) { throw new Exception("获取所有子区域的区域信息:" + exception.Message); } return table; }
public DataSet GetAllTreeInfo(string string_1) { DataSet set; SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@workId ", string_1), new SqlParameter("@UserId", this.UserId) }; try { set = new SqlDataAccess().getDataSetBySP("WebGpsClient_GetTreeInfo", parameterArray); } catch (Exception exception) { throw new Exception("获取所有树信息:" + exception.Message); } return set; }
public static int GetConfigPasswordOutDays() { int num = 30; try { object returnBySql = new SqlDataAccess().GetReturnBySql("Select a.PwdExpiredDays from GpsSysConfig a"); if (returnBySql != null) { num = Convert.ToInt32(returnBySql); } } catch { } return num; }
private void method_0(string string_0) { string str = string.Format("select distinct a.CarId as carid from gpsUserCar a where a.UserId = '{0}'", string_0); try { DataTable table = new SqlDataAccess().getDataBySql(str); if ((table != null) && (table.Rows.Count > 0)) { foreach (DataRow row in table.Rows) { this.hashtable_0.Add(row["CarId"], row["CarId"]); } } } catch (Exception exception) { ErrorMsg msg = new ErrorMsg("UserCarId", "CreateUserCarInfoToList", exception.Message + exception.StackTrace); new LogHelper().WriteError(msg); } }
public DataTable showFlagMap(string string_0) { string str = "select POIAuth from GpsSysConfig"; string str2 = "WebGpsClient_GetAreaMapFlag_mul"; SqlDataAccess access = new SqlDataAccess(); DataTable table = access.getDataBySql(str); int num = 0; if ((table == null) || (table.Rows.Count <= 0)) { return null; } if (table.Rows[0]["poiAuth"] == DBNull.Value) { return null; } num = int.Parse(table.Rows[0]["poiAuth"].ToString()); SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@POIAuth", SqlDbType.Int), new SqlParameter("@userID", SqlDbType.VarChar) }; parameterArray[0].Value = num; parameterArray[1].Value = string_0; return access.getDataBySP(str2, parameterArray); }
public static void LoadAllCarAlarmTypeList() { if ((m_CarAlarmTypeList == null) || (m_CarAlarmTypeList.Count <= 0)) { DataTable table = new SqlDataAccess().getDataBySql(m_StrSql); if ((table != null) && (table.Rows.Count > 0)) { string key = string.Empty; foreach (DataRow row in table.Rows) { AlarmType type = new AlarmType(); FillAlarmData(ref type, row); key = Convert.ToString(row["SimNum"]); if ((m_CarAlarmTypeList != null) && !m_CarAlarmTypeList.ContainsKey(key)) { m_CarAlarmTypeList.Add(key, type); } } } } }
public DataTable GetUpdata(string string_0) { DataTable cloneDataTableColumn = null; try { SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@UserId", string_0) }; DataTable table2 = new SqlDataAccess().getDataBySP("WebGpsClient_GetReachCarInf", parameterArray); cloneDataTableColumn = UpdataStruct.CloneDataTableColumn; if ((table2 == null) && (table2.Rows.Count <= 0)) { return cloneDataTableColumn; } foreach (DataRow row in table2.Rows) { DataRow row2 = cloneDataTableColumn.NewRow(); row2["GpsTime"] = Convert.ToString(row["gpstime"]); row2["ReceTime"] = Convert.ToString(row["ReceTime"]); row2["OrderID"] = Convert.ToString(row["orderId"]); row2["CarNum"] = ""; row2["OrderType"] = "信息"; row2["orderName"] = "提示信息"; row2["msgType"] = -1; row2["OrderResult"] = ""; row2["CommFlag"] = ""; row2["Describe"] = Convert.ToString(row["desc1"]); row2["Longitude"] = ""; row2["Latitude"] = ""; row2["isImportWatch"] = -1; row2["CarId"] = ""; cloneDataTableColumn.Rows.Add(row2); } } catch (Exception exception) { ErrorMsg msg = new ErrorMsg("UpdataReachCar", "GetUpdata", exception.Message); new LogHelper().WriteError(msg); } return cloneDataTableColumn; }
public static CustomerModel GetCustomer(int Id) { String sql = @"select Id, FirstName, LastName, Email, Password from dbo.Customer where Id=" + Id;; return(SqlDataAccess.LoadData <CustomerModel>(sql).ElementAt(0)); }
public void Execute(IServiceProvider serviceProvider) { SqlDataAccess sda = null; sda = new SqlDataAccess(); sda.openConnection(Globals.ConnectionString); try { #region | SERVICE | IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext)); #region | Validate Request | //Target yoksa veya Entity tipinde değilse, devam etme. if (!context.InputParameters.Contains("Target") || !(context.InputParameters["Target"] is Entity)) { return; } #endregion IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory)); IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId); #endregion Entity entity = (Entity)context.InputParameters["Target"]; #region | SET TITLECASE | if (entity.Attributes.Contains("firstname") && !string.IsNullOrEmpty(entity["firstname"].ToString())) { entity["firstname"] = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(entity["firstname"].ToString().ToLower()); } if (entity.Attributes.Contains("lastname") && !string.IsNullOrEmpty(entity["lastname"].ToString())) { entity["lastname"] = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(entity["lastname"].ToString().ToLower()); } #endregion #region | CHECK DUPLICATE | if (entity.Attributes.Contains("new_tcidentitynumber")) { if (entity["new_tcidentitynumber"] != null) { string identityNumber = entity["new_tcidentitynumber"].ToString(); MsCrmResult identityResult = ContactHelper.CheckDuplicateIdentity(identityNumber, sda); if (!identityResult.Success) { throw new Exception(identityResult.Result); } } } if (entity.Attributes.Contains("emailaddress1")) { string email = entity["emailaddress1"].ToString(); MsCrmResult emailResult = ContactHelper.CheckDuplicateEmail(email, sda); if (!emailResult.Success) { throw new Exception(emailResult.Result); } } else { throw new Exception("Email adresi boş bırakılamaz!"); } if (entity.Attributes.Contains("mobilephone")) { string mobilePhone = entity["mobilephone"].ToString(); MsCrmResult phoneResult = ContactHelper.CheckDuplicatePhone(mobilePhone, sda); if (!phoneResult.Success) { throw new Exception(phoneResult.Result); } TelephoneNumber number = GeneralHelper.CheckTelephoneNumber(mobilePhone); if (number.isFormatOK) { entity["new_countrycodemobilephone"] = number.countryCode; entity["new_cellphonenumber"] = number.phoneNo; } else { throw new Exception("Lütfen doğru bir telefon giriniz!"); } } else { throw new Exception("Cep Telefonu boş bırakılamaz!"); } #endregion #region | SET CUSTOMER NUMBER| ContactHelper.SetCustomerNumber(entity, sda); #endregion } catch (Exception ex) { throw new InvalidPluginExecutionException(ex.Message); } finally { if (sda != null) { sda.closeConnection(); } } }
public static List <CompetitiveGroup> SearchCompetitiveGroup(int id, string cgName, int cgDate = 0) { string findCmpGrps = @"SELECT * FROM CompetitiveGroup WHERE InstitutionID = @InstitutionID AND Name LIKE '%' + @Name +'%' "; var cgParams = new { InstitutionID = id, Name = cgName }; var dateParams = new { InstitutionID = id }; if (cgDate != 0) { findCmpGrps += " AND DATEPART(YEAR, CreatedDate) = @date"; } string sqlAdmsn = @"SELECT * FROM AdmissionItemType"; string sqlDirection = @"SELECT * FROM Direction"; string dates = @"SELECT DISTINCT DATEPART(YEAR, CreatedDate) FROM CompetitiveGroup WHERE InstitutionID = @InstitutionID "; var compGroups = new List <CompetitiveGroup>(); var edLevel = new List <AdmissionItemType>(); var edForm = new List <AdmissionItemType>(); SqlDataAccess <int> compGrpDates = new SqlDataAccess <int>(); compGrpDates.Request(dates, dateParams); cmpGrDates = compGrpDates.Result; SqlDataAccess <CompetitiveGroup> compGroupsInfo = new SqlDataAccess <CompetitiveGroup>(); compGroupsInfo.Request(findCmpGrps, cgParams); compGroups = compGroupsInfo.Result; SqlDataAccess <AdmissionItemType> allAdmItems = new SqlDataAccess <AdmissionItemType>(); allAdmItems.Request(sqlAdmsn); edLevel = allAdmItems.Result; edForm = allAdmItems.Result; SqlDataAccess <Direction> allDirection = new SqlDataAccess <Direction>(); allDirection.Request(sqlDirection); direction = allDirection.Result; var CompetitiveGroups = compGroups.Join(edLevel, c => c.EducationLevelID, e => e.ItemTypeID, (c, e) => { c.EducationLevelName = e.Name; return(c); }).Join(edForm, c => c.EducationFormId, ef => ef.ItemTypeID, (c, ef) => { c.EducationFormName = ef.Name; return(c); }).Join(direction, c => c.DirectionID, d => d.DirectionID, (c, d) => { c.DirectionName = d.Name; return(c); }).ToList(); EduForm = edForm.Where(e => e.ItemLevel == 7).ToList(); EduLevel = edLevel.Where(e => e.ItemLevel == 2).ToList(); return(CompetitiveGroups); }
public static List <TaggingDataModel> LoadTaggings() { string sql = @"SELECT Id, WordId, TagId FROM dbo.Taggings;"; return(SqlDataAccess.LoadData <TaggingDataModel>(sql).ToList()); }
public ImageData(SqlDataAccess sql) { _sql = sql; }
private static MsCrmResultObject GetAuthorityDocument(Guid authorityId, SqlDataAccess sda) { MsCrmResultObject returnValue = new MsCrmResultObject(); try { #region | SQL QUERY | string sqlQuery = @"SELECT R.new_registrationdocId, R.new_authorizingpersonid, R.new_authorizingpersonidName, P.ProductId, P.Name, R.new_startofauthority, R.new_endofauthority, R.new_name, P.new_projectid, P.new_projectidName, P.new_blockidName, P.new_homenumber FROM new_registrationdoc AS R WITH(NOLOCK) JOIN Product AS P WITH(NOLOCK) ON P.ProductId = R.new_productid WHERE R.new_registrationdocId = @docid" ; #endregion SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@docid", authorityId) }; DataTable dt = sda.getDataTable(sqlQuery, parameters); if (dt.Rows.Count > 0) { #region | FILL DOCUMENT INFO | AuthorityDocument _document = new AuthorityDocument(); _document.AuthorityDocumentId = (Guid)dt.Rows[0]["new_registrationdocId"]; _document.Name = dt.Rows[0]["new_name"].ToString(); if (dt.Rows[0]["new_name"] != DBNull.Value) { _document.Name = dt.Rows[0]["new_name"].ToString(); } if (dt.Rows[0]["ProductId"] != DBNull.Value) { _document.Product = new EntityReference() { Id = (Guid)dt.Rows[0]["ProductId"], Name = dt.Rows[0]["Name"].ToString(), LogicalName = "product" }; } if (dt.Rows[0]["new_projectid"] != DBNull.Value) { _document.Project = new EntityReference() { Id = (Guid)dt.Rows[0]["new_projectid"], Name = dt.Rows[0]["new_projectidName"].ToString(), LogicalName = "new_project" }; } if (dt.Rows[0]["new_authorizingpersonid"] != DBNull.Value) { _document.Contact = new EntityReference() { Id = (Guid)dt.Rows[0]["new_authorizingpersonid"], Name = dt.Rows[0]["new_authorizingpersonidName"].ToString(), LogicalName = "contact" }; } if (dt.Rows[0]["new_startofauthority"] != DBNull.Value) { _document.StartDate = (DateTime)dt.Rows[0]["new_startofauthority"]; _document.StartDateStr = ((DateTime)dt.Rows[0]["new_startofauthority"]).ToLocalTime().ToShortDateString(); } if (dt.Rows[0]["new_endofauthority"] != DBNull.Value) { _document.EndDate = (DateTime)dt.Rows[0]["new_endofauthority"]; _document.EndDateStr = ((DateTime)dt.Rows[0]["new_endofauthority"]).ToLocalTime().ToShortDateString(); } if (dt.Rows[0]["new_blockidName"] != DBNull.Value) { _document.BlockName = dt.Rows[0]["new_blockidName"].ToString(); } if (dt.Rows[0]["new_homenumber"] != DBNull.Value) { _document.HomeNumber = dt.Rows[0]["new_homenumber"].ToString(); } #endregion returnValue.Success = true; returnValue.Result = "Kayıt başarıyla alındı"; returnValue.ReturnObject = _document; } } catch (Exception ex) { returnValue.Success = false; returnValue.Result = ex.Message; } return(returnValue); }
/// <summary> /// Returns a list of all tasks in the database. /// </summary> public static List <ProjectTaskModel> GetAllProjectTasks() { return(SqlDataAccess.LoadData <ProjectTaskModel>("spGetAllProjectTasks")); }
public UserRoleDataAccess() { _sqlDataAccess = new SqlDataAccess(); }
/// <summary> /// Method to delete a tagging based on the word Id & tag Id /// </summary> /// <param name="wordid">Word Id</param> /// <param name="tagid">Tag Id</param> /// <returns>Returns the number of records changed</returns> public static int DeleteTagging(int wordid, int tagid) { string sql = "DELETE FROM dbo.Taggins WHERE WordId = @WordId AND TagId = @TagId;"; return(SqlDataAccess.UpdateData(sql, new { WordId = wordid, TagId = tagid })); }
public static List <CustomerModel> LoadCustomer() { String sql = @"select Id, FirstName, LastName, Email, Password from dbo.Customer;"; return(SqlDataAccess.LoadData <CustomerModel>(sql)); }
public static int DeleteTeam(int _TeamId) { string sql = "spDeleteTeam"; return(SqlDataAccess.DeleteRecord(sql, new { TeamId = _TeamId })); }
public static MsCrmResultObject GetCustomerSecondHands(Guid?contactid, Guid?accountid, SqlDataAccess sda) { MsCrmResultObject returnValue = new MsCrmResultObject(); try { #region | SQL QUERY | string query = @"SELECT Q.new_resalerecordId Id ,SM.Value Status FROM new_resalerecord Q WITH (NOLOCK) INNER JOIN StringMap SM WITH (NOLOCK) ON {0} AND SM.ObjectTypeCode = 10087 AND SM.AttributeName = 'statuscode' AND SM.AttributeValue = Q.StatusCode ORDER BY Q.CreatedOn DESC"; #endregion string customerId = string.Empty; if (accountid.HasValue) { customerId = string.Format("Q.new_accountid = '{0}'", accountid.Value.ToString()); } if (contactid.HasValue) { customerId = string.Format("Q.new_contactid = '{0}'", contactid.Value.ToString()); } DataTable dt = sda.getDataTable(string.Format(query, customerId)); if (dt != null && dt.Rows.Count > 0) { #region | GET SECOND HAND | List <SecondHand> returnList = new List <SecondHand>(); for (int i = 0; i < dt.Rows.Count; i++) { MsCrmResultObject rentalResult = SecondHandHelper.GetSecondHandDetail((Guid)dt.Rows[i]["Id"], sda); if (rentalResult.Success) { SecondHand _secondHand = (SecondHand)rentalResult.ReturnObject; returnList.Add(_secondHand); } } #endregion returnValue.Success = true; returnValue.ReturnObject = returnList; } else { returnValue.Success = false; returnValue.Result = "Müşteriye ait Kiralama Kaydı bulunmamaktadır!"; } } catch (Exception ex) { returnValue.Success = false; returnValue.Result = ex.Message; } return(returnValue); }
public CourseController() { _sqlDA = new SqlDataAccess(); _connString = _sqlDA.GetConnectionString("MyConnection"); }
public IngredientProcessor(SqlDataAccess sqlDataAccess) { this.sqlDataAccess = sqlDataAccess; defaultStoredProceduresPrefix = "Ingredients"; }
/// <summary> /// Internally creates and configures an instance of the DAL used for data access /// </summary> /// <returns></returns> private SqlDataAccess CreateDal() { SqlDataAccess dal = new SqlDataAccess(ConnectionString); return(dal); }
public static MsCrmResultObject GetSecondHandDetail(Guid rentalid, SqlDataAccess sda) { MsCrmResultObject returnValue = new MsCrmResultObject(); try { #region | SQL QUERY | string sqlQuery = @"SELECT q.new_name, q.new_resalerecordId, q.new_accountid, q.new_accountidName, q.new_productid, q.new_productidName, q.new_contactid, q.new_contactidName, q.new_resalespreamount, q.new_commission, q.new_salesfee, q.TransactionCurrencyId, q.TransactionCurrencyIdName, q.new_prepaymentdate, q.new_prepaymenttype, q.OwnerId, q.OwnerIdName, p.new_projectid, p.new_projectidName, p.new_paymentofhire, p.TransactionCurrencyId as pCurrencyId, p.TransactionCurrencyIdName as pCurrencyName, q.new_prepaymentdate, q.new_prepaymenttype, smStateCode.AttributeValue AS StateCode, smStateCode.Value AS StateValue, smStatusCode.AttributeValue AS StatusCode, smStatusCode.Value AS StatusValue, prodStatusCode.Value as pStatusName, prodStatusCode.AttributeValue as pStatusCode FROM new_resalerecord AS q (NOLOCK) JOIN StringMap AS smStateCode (NOLOCK) ON smStateCode.ObjectTypeCode=10087 AND smStateCode.AttributeName='statecode' AND smStateCode.AttributeValue=q.StateCode JOIN StringMap AS smStatusCode (NOLOCK) ON smStatusCode.ObjectTypeCode=10087 AND smStatusCode.AttributeName='statuscode' AND smStatusCode.AttributeValue=q.StatusCode JOIN Product as P ON q.new_productid = p.ProductId LEFT JOIN StringMap AS prodStatusCode (NOLOCK) ON prodStatusCode.ObjectTypeCode=1024 AND prodStatusCode.AttributeName='new_usedrentalandsalesstatus' AND prodStatusCode.AttributeValue=P.new_usedrentalandsalesstatus WHERE q.new_resalerecordId=@secondhandid ORDER BY q.CreatedOn DESC" ; #endregion SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@secondhandid", rentalid) }; DataTable dt = sda.getDataTable(sqlQuery, parameters); if (dt.Rows.Count > 0) { #region | FILL SECOND HAND INFO | SecondHand _secondHand = new SecondHand(); _secondHand.SecondHandId = (Guid)dt.Rows[0]["new_resalerecordId"]; _secondHand.Name = dt.Rows[0]["new_name"].ToString(); if (dt.Rows[0]["new_salesfee"] != DBNull.Value) { _secondHand.SecondHandAmount = (decimal)dt.Rows[0]["new_salesfee"]; _secondHand.SecondHandAmountStr = ((decimal)dt.Rows[0]["new_salesfee"]).ToString("N2"); } if (dt.Rows[0]["new_paymentofhire"] != DBNull.Value) { _secondHand.ProductAmount = (decimal)dt.Rows[0]["new_paymentofhire"]; _secondHand.ProductAmountStr = ((decimal)dt.Rows[0]["new_paymentofhire"]).ToString("N2"); } if (dt.Rows[0]["new_commission"] != DBNull.Value) { _secondHand.CommissionAmount = (decimal)dt.Rows[0]["new_commission"]; _secondHand.CommissionAmountStr = ((decimal)dt.Rows[0]["new_commission"]).ToString("N2"); } if (dt.Rows[0]["new_resalespreamount"] != DBNull.Value) { _secondHand.PrePayment = (decimal)dt.Rows[0]["new_resalespreamount"]; _secondHand.PrePaymentStr = ((decimal)dt.Rows[0]["new_resalespreamount"]).ToString("N2"); } if (dt.Rows[0]["OwnerId"] != DBNull.Value) { _secondHand.Owner = new EntityReference() { Id = (Guid)dt.Rows[0]["OwnerId"], Name = dt.Rows[0]["OwnerIdName"].ToString(), LogicalName = "systemuser" }; } if (dt.Rows[0]["new_contactid"] != DBNull.Value) { _secondHand.Contact = new EntityReference() { Id = (Guid)dt.Rows[0]["new_contactid"], Name = dt.Rows[0]["new_contactidName"].ToString(), LogicalName = "contact" }; } if (dt.Rows[0]["new_accountid"] != DBNull.Value) { _secondHand.Contact = new EntityReference() { Id = (Guid)dt.Rows[0]["new_accountid"], Name = dt.Rows[0]["new_accountidName"].ToString(), LogicalName = "account" }; } if (dt.Rows[0]["TransactionCurrencyId"] != DBNull.Value) { _secondHand.Currency = new EntityReference() { Id = (Guid)dt.Rows[0]["TransactionCurrencyId"], Name = dt.Rows[0]["TransactionCurrencyIdName"].ToString(), LogicalName = "transactioncurrency" }; } if (dt.Rows[0]["pCurrencyId"] != DBNull.Value) { _secondHand.pCurrency = new EntityReference() { Id = (Guid)dt.Rows[0]["pCurrencyId"], Name = dt.Rows[0]["pCurrencyName"].ToString(), LogicalName = "transactioncurrency" }; } if (dt.Rows[0]["new_productid"] != DBNull.Value) { _secondHand.Product = new EntityReference() { Id = (Guid)dt.Rows[0]["new_productid"], Name = dt.Rows[0]["new_productidName"].ToString(), LogicalName = "product" }; } if (dt.Rows[0]["new_projectid"] != DBNull.Value) { _secondHand.Project = new EntityReference() { Id = (Guid)dt.Rows[0]["new_projectid"], Name = dt.Rows[0]["new_projectidName"].ToString(), LogicalName = "new_project" }; } if (dt.Rows[0]["new_prepaymentdate"] != DBNull.Value) { _secondHand.PrePaymentDate = (DateTime)dt.Rows[0]["new_prepaymentdate"]; _secondHand.PrePaymentDateStr = ((DateTime)dt.Rows[0]["new_prepaymentdate"]).ToLocalTime().ToShortDateString(); } if (dt.Rows[0]["new_prepaymenttype"] != DBNull.Value) { _secondHand.PrePaymentType = (int)dt.Rows[0]["new_prepaymenttype"]; } _secondHand.StateCode = new StringMap() { Name = dt.Rows[0]["StateValue"].ToString(), Value = (int)dt.Rows[0]["StateCode"] }; _secondHand.StatusCode = new StringMap() { Name = dt.Rows[0]["StatusValue"].ToString(), Value = (int)dt.Rows[0]["StatusCode"] }; _secondHand.pStatusCode = new StringMap() { Name = dt.Rows[0]["pStatusName"].ToString(), Value = (int)dt.Rows[0]["pStatusCode"] }; #endregion returnValue.Success = true; returnValue.ReturnObject = _secondHand; } } catch (Exception ex) { returnValue.Success = false; returnValue.Result = ex.Message; } return(returnValue); }
public static int DeleteYear(int yearId) { string sql = "spDeleteYear"; return(SqlDataAccess.DeleteRecord(sql, new { YearId = yearId })); }
public static List <Brand> GetAllBrands(string connectionString) { SqlDataAccess dataAccess = new SqlDataAccess(connectionString); return(dataAccess.LoadData <Brand>(StoreProceduresList.SP_SELECT_ALL_BRANDS)); }
public static List <YearModel> SelectYears( ) { string sql = "spSelectYears"; return(SqlDataAccess.LoadData <YearModel>(sql)); }
// READ customer list from the DB public static List <CustomerDataModel> LoadCustomers() { string sql = @"SELECT * FROM Customer"; return(SqlDataAccess.LoadData <CustomerDataModel>(sql)); }
public static MsCrmResultObject MakeAuthorityDocSearch(Guid?projectId, DateTime?startDate, DateTime?endDate, IOrganizationService service, SqlDataAccess sda) { MsCrmResultObject returnValue = new MsCrmResultObject(); try { SqlParameter[] parameters = null; #region | SQL QUERY | string query = @"SELECT R.new_registrationdocId FROM new_registrationdoc R WITH (NOLOCK) JOIN Product as P WITH(NOLOCK) ON P.ProductId = R.new_productid WHERE P.StateCode = 0" ; if (projectId.HasValue) { query += @" AND P.new_projectid = '{0}'" ; query = string.Format(query, projectId.Value); } else { OrganizationServiceContext orgServiceContext = new OrganizationServiceContext(service); var linqQuery = (from a in orgServiceContext.CreateQuery("new_project") where ((OptionSetValue)a["statecode"]).Value == 0 select new { Id = a.Id }).ToList(); if (linqQuery != null && linqQuery.Count > 0) { query += @" AND P.new_projectid IN(" ; for (int i = 0; i < linqQuery.Count; i++) { if (i != linqQuery.Count - 1) { query += "'" + linqQuery[i].Id + "',"; } else { query += "'" + linqQuery[i].Id + "'"; } } query += ")"; } } if (startDate.HasValue) { query += @" AND R.new_startofauthority >= @minValue" ; parameters = new SqlParameter[] { new SqlParameter("@minValue", startDate.Value) }; } else if (endDate.HasValue) { query += @" AND R.new_endofauthority <= @maxValue" ; parameters = new SqlParameter[] { new SqlParameter("@maxValue", endDate.Value) }; } #endregion DataTable dt = null; if (parameters == null) { dt = sda.getDataTable(query); } else { dt = sda.getDataTable(query, parameters); } if (dt != null && dt.Rows.Count > 0) { #region | GET PRODUCTS | List <AuthorityDocument> returnList = new List <AuthorityDocument>(); for (int i = 0; i < dt.Rows.Count; i++) { AuthorityDocument doc = (AuthorityDocument)GetAuthorityDocument((Guid)dt.Rows[i]["new_registrationdocId"], sda).ReturnObject; returnList.Add(doc); } #endregion returnValue.Success = true; returnValue.ReturnObject = returnList; } else { returnValue.Success = false; returnValue.Result = "Aradığınız kriterlere ait konut bulunmamaktadır!"; } } catch (Exception ex) { returnValue.Success = false; returnValue.Result = ex.Message; } return(returnValue); }
public void SaveInventoryRecord(InventoryModel item) { SqlDataAccess sql = new SqlDataAccess(config); sql.SaveData("dbo.spInventory_Insert", item, "KelvinData"); }
public static MsCrmResult UpdateOrCreateSecondHand(SecondHand _secondHand, IOrganizationService service, SqlDataAccess sda) { MsCrmResult returnValue = new MsCrmResult(); try { Entity ent = new Entity("new_resalerecord"); ent["new_name"] = _secondHand.Name; if (_secondHand.Contact != null) { ent["new_contactid"] = _secondHand.Contact; } if (_secondHand.Account != null) { ent["new_accountid"] = _secondHand.Account; } if (_secondHand.Owner != null) { ent["ownerid"] = _secondHand.Owner; } if (_secondHand.Product != null) { ent["new_productid"] = _secondHand.Product; } if (_secondHand.SecondHandAmount != null) { ent["new_salesfee"] = new Money(_secondHand.SecondHandAmount.Value); } if (_secondHand.Currency != null) { ent["transactioncurrencyid"] = _secondHand.Currency; } if (_secondHand.CommissionAmount != null) { ent["new_commission"] = new Money(_secondHand.CommissionAmount.Value); } if (_secondHand.Currency != null) { ent["transactioncurrencyid"] = new EntityReference("transactioncurrency", _secondHand.Currency.Id); } if (_secondHand.Currency != null) { ent["transactioncurrencyid"] = new EntityReference("transactioncurrency", _secondHand.Currency.Id); } if (_secondHand.StatusCode != null) { if (_secondHand.StatusCode.Value == (int)SecondHandStatuses.Onaylandi) { ent["new_prepaymentdate"] = DateTime.Now; if (_secondHand.PrePayment.HasValue) { ent["new_resalespreamount"] = new Money(_secondHand.PrePayment.Value); } if (_secondHand.PrePaymentType.HasValue) { ent["new_prepaymenttype"] = new OptionSetValue(_secondHand.PrePaymentType.Value); } } } if (_secondHand.SecondHandId.HasValue) { ent.Id = _secondHand.SecondHandId.Value; service.Update(ent); returnValue.CrmId = _secondHand.SecondHandId.Value; returnValue.Success = true; returnValue.Result = "2.El Satış kaydı başarıyla güncelleştirildi."; } else { returnValue.CrmId = service.Create(ent); returnValue.Success = true; returnValue.Result = "2.El Satış kaydı başarıyla oluşturuldu."; } } catch (Exception ex) { returnValue.Success = false; returnValue.Result = ex.Message; } return(returnValue); }
public void DeleteUser(int id) { string sql = "Delete from users where userid = " + id; SqlDataAccess.DeleteData(sql); }
public static List <Campaign> SearchCampaign(int id, int selectDate = 0) { string sqlDates = " SELECT DISTINCT DATEPART(YEAR, CreatedDate) FROM Campaign "; string sqlCmgn = @" SELECT * FROM Campaign WHERE Campaign.InstitutionID = @InstitutionID"; var p = new { InstitutionID = id }; if (selectDate != 0) { sqlCmgn += " AND YearStart = " + selectDate; } string sqlEduForms = @"SELECT * FROM EducationForms"; string sqlStsName = @"SELECT c.StatusID, c.Name FROM CampaignStatus c"; string sqlCmgnTypes = @" SELECT * FROM CampaignTypes"; // Отдельные запросы на данные из Campaign и справочников SqlDataAccess <Campaign> allCampagns = new SqlDataAccess <Campaign>(); allCampagns.Request(sqlCmgn, p); Campaigns = allCampagns.Result; SqlDataAccess <CampaignTypes> allCmgnTypes = new SqlDataAccess <CampaignTypes>(); allCmgnTypes.Request(sqlCmgnTypes); CmgnTypes = allCmgnTypes.Result; SqlDataAccess <EducationForm> allEduForm = new SqlDataAccess <EducationForm>(); allEduForm.Request(sqlEduForms); EduForm = allEduForm.Result; SqlDataAccess <CampaignStatus> allStsName = new SqlDataAccess <CampaignStatus>(); allStsName.Request(sqlStsName); StsName = allStsName.Result; SqlDataAccess <int> allDates = new SqlDataAccess <int>(); allDates.Request(sqlDates); Dates = allDates.Result; //Формирование одного листа по данным из Campaign и справочников по Id var cmgnJoins = Campaigns.Join(CmgnTypes, c => c.CampaignTypeID, s => s.CampaignTypeID, (c, s) => { c.CampaignTypeName = s.Name; return(c); }).Join(EduForm, c => c.EducationFormFlag, e => e.Id, (c, e) => { c.EducationFormName = e.Name; return(c); }).Join(StsName, c => c.StatusID, e => e.StatusID, (c, e) => { c.CampaignStatusName = e.Name; return(c); }).ToList(); return(cmgnJoins); }
public RoleDataAccess() { sqlDataAccess = new SqlDataAccess(); }
public void Execute(IServiceProvider serviceProvider) { SqlDataAccess sda = null; try { sda = new SqlDataAccess(); sda.openConnection(Globals.ConnectionString); #region | SERVICE | IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext)); #region | Validate Request | //Target yoksa veya Entity tipinde değilse, devam etme. if (!context.InputParameters.Contains("Target") || !(context.InputParameters["Target"] is Entity)) { return; } #endregion IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory)); IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId); #endregion Entity entity = (Entity)context.InputParameters["Target"]; #region | VARIABLES | List <ScoreLimit> lstLimits = new List <ScoreLimit>(); EntityReference portal = null; EntityReference user = null; if (entity.Contains("new_portalid") && entity["new_portalid"] != null) { portal = (EntityReference)entity["new_portalid"]; } if (entity.Contains("new_userid") && entity["new_userid"] != null) { user = (EntityReference)entity["new_userid"]; } #endregion MsCrmResultObject limitRes = ScoreHelper.GetScoreLimitsByType(ScoreType.PostComment, sda); if (limitRes.Success) { lstLimits = (List <ScoreLimit>)limitRes.ReturnObject; for (int i = 0; i < lstLimits.Count; i++) { int recCount = 0; DateTime start = GeneralHelper.GetStartDateByScorePeriod(lstLimits[i].Period); DateTime end = GeneralHelper.GetEndDateByScorePeriod(lstLimits[i].Period); recCount = CommentHelper.GetUserCommentCount(portal.Id, user.Id, start, end, sda); if (lstLimits[i].Frequency >= recCount) { Score sc = new Score() { Point = lstLimits[i].Point, Portal = portal, User = user, ScoreType = ScoreType.PostComment }; MsCrmResult scoreRes = ScoreHelper.CreateScore(sc, service); break; } } } } catch (Exception ex) { //LOG throw new InvalidPluginExecutionException(ex.Message); } finally { if (sda != null) { sda.closeConnection(); } } }
public static MsCrmResultObject GetModuleRecordCount(Guid portalId, Guid portalUserId, SqlDataAccess sda) { MsCrmResultObject returnValue = new MsCrmResultObject(); try { #region | SQL QUERY | string query = @"DECLARE @Date DATETIME = GETUTCDATE() -- 1->Graffiti, 2->Education, 3->Article, 4->Video, 5->Announce, 6->Friend, 7->Forum SELECT COUNT(0) AS RecCount ,1 AS RecType FROM new_graffiti PG (NoLock) WHERE PG.new_portalId='{0}' AND PG.statecode=0 AND PG.statuscode=1 --Active UNION ALL SELECT COUNT(DISTINCT E.new_educationId) AS RecCount ,2 AS RecType FROM new_education AS E (NOLOCK) JOIN new_new_user_new_role AS UR (NOLOCK) ON UR.new_userid='{1}' JOIN new_role AS RD (NOLOCK) ON RD.new_roleId=UR.new_roleid AND Rd.statecode=0 AND RD.statuscode=1 --Active JOIN new_new_education_new_role AS ERDF (NOLOCK) ON ERDF.new_educationid=E.new_educationId AND ERDF.new_roleid=RD.new_roleId WHERE @Date BETWEEN E.new_startdate AND E.new_enddate AND E.new_portalId = '{0}' AND E.StateCode=0 AND E.StatusCode=1 --Active UNION ALL SELECT COUNT(DISTINCT E.new_articleId) AS RecCount ,3 AS RecType FROM new_article AS E (NOLOCK) JOIN new_new_user_new_role AS UR (NOLOCK) ON UR.new_userid='{1}' JOIN new_role AS RD (NOLOCK) ON RD.new_roleId=UR.new_roleid AND Rd.statecode=0 AND RD.statuscode=1 --Active JOIN new_new_article_new_role AS ERDF (NOLOCK) ON ERDF.new_articleid=E.new_articleId AND ERDF.new_roleid =RD.new_roleId WHERE @Date BETWEEN E.new_startdate AND E.new_enddate AND E.new_portalId = '{0}' AND E.statuscode=1 --Active UNION ALL SELECT COUNT(DISTINCT E.new_videoId) AS RecCount ,4 AS RecType FROM new_video AS E (NOLOCK) JOIN new_new_user_new_role AS UR (NOLOCK) ON UR.new_userid='{1}' JOIN new_role AS RD (NOLOCK) ON RD.new_roleId=UR.new_roleid AND Rd.statecode=0 AND RD.statuscode=1 --Active JOIN new_new_video_new_role AS ERDF (NOLOCK) ON ERDF.new_videoid=E.new_videoId AND ERDF.new_roleid=RD.new_roleId WHERE @Date BETWEEN E.new_startdate AND E.new_enddate AND E.new_portalId = '{0}' AND E.statuscode=1 --Active UNION ALL SELECT COUNT(DISTINCT A.new_announcementId) AS RecCount ,5 AS RecType FROM new_announcement A (NoLock) JOIN new_new_user_new_role AS UR (NOLOCK) ON UR.new_userid='{1}' JOIN new_role AS RD (NOLOCK) ON RD.new_roleId=UR.new_roleid AND Rd.statecode=0 AND RD.statuscode=1 --Active JOIN new_new_announcement_new_role AS ERDF (NOLOCK) ON ERDF.new_announcementid=A.new_announcementId AND ERDF.new_roleid=RD.new_roleId WHERE @Date BETWEEN A.new_startdate AND A.new_enddate AND A.new_portalId='{0}' AND A.StateCode = 0 AND A.StatusCode=1 --Active UNION ALL SELECT COUNT(0) AS RecCount ,6 AS RecType FROM new_friendship AS f (NOLOCK) WHERE f.new_portalId='{0}' AND f.statecode=0 AND (f.new_partyoneId='{1}' OR f.new_partytwoId='{1}') UNION ALL SELECT COUNT(0) AS RecCount ,7 AS RecType FROM new_forum AS f (NOLOCK) JOIN new_new_forum_new_role AS fr (NOLOCK) ON fr.new_forumid=f.new_forumId JOIN new_role AS r (NOLOCK) ON r.new_roleId=fr.new_roleid AND r.statecode=0 AND r.statuscode=1 --Active JOIN new_new_user_new_role AS ur (NOLOCK) ON ur.new_userid='{1}' WHERE f.new_parentforumId IS NULL AND f.new_portalId='{0}' AND f.statecode=0 AND f.statuscode=1 --Active "; #endregion DataTable dt = sda.getDataTable(string.Format(query, portalId, portalUserId)); if (dt.Rows.Count > 0) { List <ModuleCount> lstModuleCount = new List <ModuleCount>(); for (int i = 0; i < dt.Rows.Count; i++) { ModuleCount mc = new ModuleCount() { RecCount = (int)dt.Rows[i]["RecCount"], RecType = (int)dt.Rows[i]["RecType"] }; lstModuleCount.Add(mc); } returnValue.Success = true; returnValue.ReturnObject = lstModuleCount; } else { returnValue.Success = false; returnValue.Result = "Kayıt sayıları çekildi."; } } catch (Exception ex) { returnValue.Success = false; returnValue.Result = ex.Message; } return(returnValue); }
public LoginOnlieUserInfo(string string_1) { this.int_0 = -1; this.sqlDataAccess_0 = new SqlDataAccess(); this.UserId = string_1; }
/// <summary> /// Method to determine the number of words of a specific language /// </summary> /// <param name="languageid">Language Id associated with the word</param> /// <returns>Returns the number of words of a specific language as an int</returns> public static int getWordsCount(int languageid) { string sql = "SELECT COUNT(Id) FROM dbo.Words WHERE LanguageId = " + languageid.ToString() + ";"; return(SqlDataAccess.getTableCount(sql)); }
public Response icar_SetCallLimit(CmdParam.ParamType paramType_0, string string_1, string string_2, CmdParam.CommMode commMode_0, CallLimit callLimit_0) { Response response = new Response(); base.logMsg.FunctionName = "icar_SetCallLimit"; base.logMsg.Msg = "发送:类型-" + paramType_0.ToString() + ",车辆-" + string_1 + ",指令-" + callLimit_0.OrderCode.ToString(); string str = "发送车台呼叫限制"; base.log.WriteLog(base.logMsg); if (!base.CheckCar(paramType_0, string_1, string_2)) { response.ErrorMsg = base.alarmMsg.AlarmText = base.ErrorMsg; base.log.WriteAlarm(base.alarmMsg); return response; } string strErrorMsg = string.Empty; if (callLimit_0.CheckData(out strErrorMsg) != 0) { response.ErrorMsg = strErrorMsg; return response; } if (base.isStartCommon()) { foreach (Bussiness.CarInfo info in base.carInfoList) { try { object callInPhone = callLimit_0.CallInPhone; object callOutPhone = callLimit_0.CallOutPhone; int newOrderId = SendBase.CarCmdSend.GetNewOrderId(); base.SaveCmdParm(newOrderId.ToString() + "|" + info.CarId.ToString() + ";"); string orderIDParam = response.OrderIDParam; response.OrderIDParam = orderIDParam + newOrderId.ToString() + "|" + info.CarId.ToString() + ";"; base.userInfo.DownCommd.AddCarNewLogData(newOrderId, info.CarNum, "发送", callLimit_0.OrderCode.ToString(), "等待", "", str); SqlDataAccess access = new SqlDataAccess(); string str3 = string.Format(" insert into GisCarInfoTable_Tmp(carID, wrkID, orderID, carControlType, carControlMask, callInLst, callOutLst) values({0}, {1}, {2}, {3}, {4}, '{5}','{6}')", new object[] { info.CarId, base.WorkId, newOrderId, callLimit_0.FlagValue, callLimit_0.FlagMask, callLimit_0.CallInPhoneString, callLimit_0.CallOutPhoneString }); int num2 = access.insertBySql(str3); if (num2 != 1) { base.alarmMsg.FunctionName = "icar_SetCallLimit"; base.alarmMsg.AlarmText = string.Concat(new object[] { "workid-", base.WorkId, ",simNum-", info.SimNum, ",OrderCode-", callLimit_0.OrderCode }); base.alarmMsg.Code = num2.ToString(); base.log.WriteAlarm(base.alarmMsg); } long num3 = SendBase.CarCmdSend.icar_SetCallLimit(base.WorkId, newOrderId, info.SimNum, callLimit_0.FlagValue, callLimit_0.FlagMask, ref callInPhone, ref callOutPhone); if (num3 != 0L) { base.alarmMsg.FunctionName = "icar_SetCallLimit"; base.alarmMsg.AlarmText = string.Concat(new object[] { "workid-", base.WorkId, ",simNum-", info.SimNum, ",OrderCode-", callLimit_0.OrderCode }); base.alarmMsg.Code = num3.ToString(); base.log.WriteAlarm(base.alarmMsg); } response.ResultCode = 0L; } catch (Exception exception) { base.errMsg.ErrorText = "下发消息指令时发生错误!"; response.ErrorMsg = base.ErrorMsg = base.errMsg.ErrorText; base.log.WriteError(base.errMsg, exception); } } return response; } response.ErrorMsg = base.ErrorMsg; return response; }
public static MsCrmResult SendMailSecondHandToApproval(Product secondHandProduct, Entity _secondHand, UserTypes type, SqlDataAccess sda, IOrganizationService service) { MsCrmResult returnValue = new MsCrmResult(); try { #region | SEND INFORMATIONS | string projectName = secondHandProduct.Project != null ? secondHandProduct.Project.Name : string.Empty; string blockName = secondHandProduct.Block != null ? secondHandProduct.Block.Name : string.Empty; string floorNumber = secondHandProduct.FloorNumber != null?secondHandProduct.FloorNumber.ToString() : string.Empty; string generalhomeType = secondHandProduct.GeneralHomeType != null ? secondHandProduct.GeneralHomeType.Name : string.Empty; string homeType = secondHandProduct.HomeType != null ? secondHandProduct.HomeType.Name : string.Empty; string net = secondHandProduct.Net != null ? ((decimal)secondHandProduct.Net).ToString("N0", CultureInfo.CurrentCulture) : string.Empty; string brut = secondHandProduct.Brut != null ? ((decimal)secondHandProduct.Brut).ToString("N0", CultureInfo.CurrentCulture) : string.Empty; string productAmount = secondHandProduct.PaymentOfHire.HasValue ? secondHandProduct.PaymentOfHire.Value.ToString("N2") : string.Empty; string rentalAmount = _secondHand.GetAttributeValue <Money>("new_salesfee") != null?_secondHand.GetAttributeValue <Money>("new_salesfee").Value.ToString("N2") : string.Empty; string currencyName = _secondHand.GetAttributeValue <EntityReference>("transactioncurrencyid") != null ? (_secondHand.GetAttributeValue <EntityReference>("transactioncurrencyid")).Name : string.Empty; #endregion #region | GET CURRENCY | string exchangeRate = string.Empty; Guid currencyId = (_secondHand.GetAttributeValue <EntityReference>("transactioncurrencyid")).Id; MsCrmResultObject currencyResult = CurrencyHelper.GetExchangeRateByCurrency(DateTime.Now, currencyId, sda); if (currencyResult.Success) { ExchangeRate rate = (ExchangeRate)currencyResult.ReturnObject; exchangeRate = ((decimal)rate.SaleRate).ToString("N0", CultureInfo.CurrentCulture); } #endregion string body = "<table>"; body += "<tr><td>Proje : </td><td>" + projectName + "</td></tr>"; body += "<tr><td>Blok : </td><td>" + blockName + "</td></tr>"; body += "<tr><td>Kat : </td><td>" + floorNumber + "</td></tr>"; body += "<tr><td>Daire No : </td><td>" + secondHandProduct.HomeNumber + "</td></tr>"; body += "<tr><td>Tip : </td><td>" + generalhomeType + "</td></tr>"; body += "<tr><td>Daire Tipi : </td><td>" + homeType + "</td></tr>"; body += "<tr><td>Konut Satış Fiyatı Fiyatı : </td><td>" + productAmount + "</td></tr>"; body += "<tr><td>Satılmak İstenen Fiyat : </td><td>" + rentalAmount + "</td></tr>"; body += "<tr><td>Net m2 : </td><td>" + net + "</td></tr>"; body += "<tr><td>Brüt m2 : </td><td>" + brut + "</td></tr>"; body += "<tr><td>Para Birimi : </td><td>" + currencyName + "</td></tr>"; body += "<tr><td>Güncel Kur : </td><td>" + exchangeRate + "</td></tr>"; body += "</table>"; body += "<br/>"; body += "<br/>"; body += "<a href='{0}' target='_blank'>Kiralamayı onaylamak/reddetmek için lütfen tıklayınız.</a>"; string url = "http://fenix.centralproperty.com.tr/index.aspx?page=secondhandconfirm&name=secondhandid&pageid=" + _secondHand.Id; body = string.Format(body, url); //MsCrmResultObject managerResult = SystemUserHelper.GetSalesManager(sda); MsCrmResultObject managerResult = SystemUserHelper.GetUsersByUserTypes(type, sda); if (managerResult != null && managerResult.Success) { Entity fromParty = new Entity("activityparty"); fromParty["partyid"] = _secondHand.GetAttributeValue <EntityReference>("ownerid"); Entity[] fromPartyColl = new Entity[] { fromParty }; #region | SET TO | List <SystemUser> returnList = (List <SystemUser>)managerResult.ReturnObject; Entity[] toPartyColl = new Entity[returnList.Count]; for (int i = 0; i < returnList.Count; i++) { Entity toParty = new Entity("activityparty"); toParty["partyid"] = new EntityReference("systemuser", returnList[i].SystemUserId); toPartyColl[i] = toParty; } #endregion Annotation anno = null; MsCrmResult mailResult = GeneralHelper.SendMail(_secondHand.Id, "new_resalerecord", fromPartyColl, toPartyColl, "2.El Satış Onayı", body, anno, service); returnValue = mailResult; } else { returnValue.Success = false; returnValue.Result = managerResult.Result; } } catch (Exception ex) { returnValue.Success = false; returnValue.Result = ex.Message; } return(returnValue); }