public static string DuplicateEmailId(string EmailId) { try { string ReturnMsg = "1"; Int32 CountUser = QueryBuilder.GetInt("Count(*)", "tblusers", "Where EmailId = '" + EmailId + "'"); if (CountUser > 0) { ReturnMsg = ValidDuplicateEmailId.ToString(); } return(ReturnMsg); } catch (Exception ex) { return(ErrorComman); } finally { } }
public static string DuplicateUpdateRole(string Role, string RoleId) { try { string ReturnMsg = "1"; Int32 CountUser = QueryBuilder.GetInt("Count(*)", "mtblroles", "Where Role = '" + Role + "' And id != '" + RoleId + "'"); if (CountUser > 0) { ReturnMsg = ValidDuplicateRoleId.ToString(); } return(ReturnMsg); } catch (Exception ex) { return(ErrorComman); } finally { } }
public static string DuplicateAuthToken(string UserId, string AuthToken, string DeviceId) { try { string ReturnMsg = "1"; Int32 CountUser = QueryBuilder.GetInt("Count(*)", "tbluserauthtokens", "Where UserId = '" + UserId + "' And AuthToken = '" + AuthToken + "' And DeviceId = '" + DeviceId + "'"); if (CountUser > 0) { ReturnMsg = ValidDuplicateAuthToken.ToString(); } return(ReturnMsg); } catch (Exception ex) { return(ErrorComman); } finally { } }
public static string DuplicateUpdatePhone(string Phone, string PriUserId) { try { string ReturnMsg = "1"; Int32 CountUser = QueryBuilder.GetInt("Count(*)", "tblusers", "Where Phone = '" + Phone + "' And id != '" + PriUserId + "'"); if (CountUser > 0) { ReturnMsg = ValidDuplicatePhone.ToString(); } return(ReturnMsg); } catch (Exception ex) { return(ErrorComman); } finally { } }
public string SetDevice(string DeviceName, string DeviceNo, string UserId) { string IsSet = Validation.UnsuccessDeviceProfile; try { AppLog.WriteErrorLog("Function (POST) : DeviceProfile/SetDevice"); DataTable dt = QueryBuilder.GetDataTable("DeviceMastreId", "gdt_device", "Where DeviceNo = '" + DeviceNo + "'"); if (dt.Rows.Count > 0) { bool IsSet1 = false; string Date = DateTime.Now.Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute; IsSet1 = QueryBuilder.UpdateDB("DeviceName = '" + DeviceName + "', HDate = '" + Date + "'", "gdt_device", " Where DeviceNo = '" + DeviceNo + "'"); if (IsSet1 == true) { IsSet = Validation.SuccessDeviceProfile; DataTable dt1 = QueryBuilder.GetDataTable("Id", "gdt_deviceprofile", " Where (select DeviceNo from gdt_device where DeviceId = DeviceMastreId LIMIT 1) = '" + DeviceNo + "' AND UserId = '" + UserId + "'"); if (dt1.Rows.Count > 0) { } else { bool IsSet2 = false; string Date1 = DateTime.Now.Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute; Int32 DeviceMasterId = QueryBuilder.GetInt("DeviceMastreId", "gdt_device", " Where DeviceNo = '" + DeviceNo + "' LIMIT 1"); IsSet2 = QueryBuilder.InsertInDB("gdt_deviceprofile", "DeviceId,UserId,DeviceDateTime,HDate", "'" + DeviceMasterId.ToString() + "','" + UserId + "','" + Date1 + "','" + Date1 + "'"); if (IsSet2 == true) { IsSet = Validation.SuccessDeviceProfile; SetActivityLog(DeviceMasterId.ToString(), "Profile Created", UserId, Date); } } } } else { bool IsSet1 = false; string Date = DateTime.Now.Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute; IsSet1 = QueryBuilder.InsertInDB("gdt_device", "DeviceName,DeviceNo,Date,HDate", "'" + DeviceName + "','" + DeviceNo + "','" + Date + "','" + Date + "'"); if (IsSet1 == true) { IsSet = Validation.SuccessDeviceProfile; Int32 DeviceMasterId = QueryBuilder.GetInt("DeviceMastreId", "gdt_device", " Where DeviceNo = '" + DeviceNo + "' LIMIT 1"); SetActivityLog(DeviceMasterId.ToString(), "Device Created", UserId, Date); DataTable dt1 = QueryBuilder.GetDataTable("Id", "gdt_deviceprofile", " Where (select DeviceNo from gdt_device where DeviceId = DeviceMastreId LIMIT 1) = '" + DeviceNo + "' AND UserId = '" + UserId + "'"); if (dt1.Rows.Count > 0) { } else { bool IsSet2 = false; string Date1 = DateTime.Now.Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute; Int32 DeviceMasterId1 = QueryBuilder.GetInt("DeviceMastreId", "gdt_device", " Where DeviceNo = '" + DeviceNo + "' LIMIT 1"); IsSet2 = QueryBuilder.InsertInDB("gdt_deviceprofile", "DeviceId,UserId,DeviceDateTime,HDate", "'" + DeviceMasterId1.ToString() + "','" + UserId + "','" + Date1 + "','" + Date1 + "'"); if (IsSet2 == true) { IsSet = Validation.SuccessDeviceProfile; SetActivityLog(DeviceMasterId1.ToString(), "Profile Created", UserId, Date); } } } } return(IsSet); } catch (Exception ex) { return(Validation.ErrorComman); } finally {// return IsSet; } } }