Skip to content

Commit

Permalink
Save image to database, logout funciton
Browse files Browse the repository at this point in the history
  • Loading branch information
UtmoD committed Dec 16, 2019
1 parent 6b239d7 commit b4ebe86
Show file tree
Hide file tree
Showing 15 changed files with 1,591 additions and 658 deletions.
405 changes: 405 additions & 0 deletions Database/createTable.sql

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions source/CafeteriaManagement/CM.BLL/DataProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ public static void DeleteBillBy(string productName)
DataProvider.DeleteBill(productId);
}

public static bool ValidateAccount(string username, string password)
public static string ValidateAccount(string username, string password)
{
var userId = "";
var hashedPassword = password.GetMD5HashedString();
var isValid = DataProvider.ValidateAccount(username, hashedPassword);
return isValid;
userId = DataProvider.ValidateAccount(username, hashedPassword);
return userId;
}


Expand Down Expand Up @@ -107,6 +108,8 @@ where id.GetMD5HashedString() == code
PassWord = password.GetMD5HashedString(),
EmployeeId = employeeId
};
var accountImage = new ACCOUNT_IMAGE { Id = GetNextAccountID() };
DataProvider.InsertRecord(accountImage, "ACCOUNT_IMAGE");
DataProvider.InsertRecord(account, "ACCOUNT");
}

Expand Down
2 changes: 1 addition & 1 deletion source/CafeteriaManagement/CM.DAL/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</configSections>
<connectionStrings>
<add name="CM.DAL.Properties.Settings.CAFEMANAGEMENTConnectionString1"
connectionString="Data Source=DESKTOP-C6O1GGF;Initial Catalog=CAFEMANAGEMENT;Integrated Security=True"
connectionString="Data Source=localhost;Initial Catalog=CAFEMANAGEMENT;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<startup>
Expand Down
8 changes: 8 additions & 0 deletions source/CafeteriaManagement/CM.DAL/CM.dbml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<Column Name="PassWord" Type="System.String" DbType="NVarChar(100) NOT NULL" CanBeNull="false" />
<Column Name="AccountType" Type="System.Int32" DbType="Int" CanBeNull="true" />
<Column Name="EmployeeId" Type="System.String" DbType="Char(5) NOT NULL" CanBeNull="false" />
<Association Name="ACCOUNT_ACCOUNT_IMAGE" Member="ACCOUNT_IMAGE" ThisKey="Id" OtherKey="Id" Type="ACCOUNT_IMAGE" Cardinality="One" />
<Association Name="EMPLOYEE_ACCOUNT" Member="EMPLOYEE" ThisKey="EmployeeId" OtherKey="Id" Type="EMPLOYEE" IsForeignKey="true" />
</Type>
</Table>
Expand Down Expand Up @@ -72,4 +73,11 @@
<Association Name="PRODUCTTYPE_PRODUCT" Member="PRODUCTs" ThisKey="Id" OtherKey="ProductId" Type="PRODUCT" />
</Type>
</Table>
<Table Name="dbo.ACCOUNT_IMAGE" Member="ACCOUNT_IMAGEs">
<Type Name="ACCOUNT_IMAGE">
<Column Name="Id" Type="System.String" DbType="Char(5) NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
<Column Name="Img" Type="System.Data.Linq.Binary" DbType="VarBinary(MAX)" CanBeNull="true" UpdateCheck="Never" />
<Association Name="ACCOUNT_ACCOUNT_IMAGE" Member="ACCOUNT" ThisKey="Id" OtherKey="Id" Type="ACCOUNT" IsForeignKey="true" />
</Type>
</Table>
</Database>
25 changes: 19 additions & 6 deletions source/CafeteriaManagement/CM.DAL/CM.dbml.layout
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<elementListCompartment Id="2a7fee69-efe9-4705-8b5f-ade7af4f1a1a" absoluteBounds="3.8899999999999997, 1.46, 1.9700000000000002, 0.8262939453125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
</nestedChildShapes>
</classShape>
<associationConnector edgePoints="[(5.875 : 1.81814697265625); (6.125 : 1.81814697265625)]" fixedFrom="Algorithm" fixedTo="Algorithm">
<associationConnector edgePoints="[(5.875 : 1.81814697265625); (6.125 : 1.81814697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
<AssociationMoniker Name="/CMDataContext/CUSTOMER/CUSTOMER_BILL" />
<nodes>
<classShapeMoniker Id="523bfbdf-4927-4700-b986-b7db4cbae6c0" />
Expand All @@ -33,14 +33,14 @@
<elementListCompartment Id="30f6c0f7-7859-408b-979a-4633ed52177b" absoluteBounds="4.015, 6.835, 1.9700000000000002, 1.5954996744791665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
</nestedChildShapes>
</classShape>
<associationConnector edgePoints="[(5.96875 : 6.375); (5.96875 : 3.14829752604167); (7.04166666666667 : 3.14829752604167 : JumpStart); (7.20833333333333 : 3.14829752604167 : JumpEnd); (9.75 : 3.14829752604167)]" fixedFrom="Algorithm" fixedTo="Algorithm">
<associationConnector edgePoints="[(5.96875 : 6.375); (5.96875 : 3.14829752604167); (7.04166666666667 : 3.14829752604167 : JumpStart); (7.20833333333333 : 3.14829752604167 : JumpEnd); (9.75 : 3.14829752604167)]" fixedFrom="NotFixed" fixedTo="NotFixed">
<AssociationMoniker Name="/CMDataContext/EMPLOYEE/EMPLOYEE_ACCOUNT" />
<nodes>
<classShapeMoniker Id="3a64c501-67da-4ab5-9a9d-1186b788e2f6" />
<classShapeMoniker Id="06e1b7ec-d503-4025-9491-7ec236d7b5da" />
</nodes>
</associationConnector>
<associationConnector edgePoints="[(6 : 7.45274983723958); (7.125 : 7.45274983723958); (7.125 : 3.02089680989583)]" fixedFrom="Algorithm" fixedTo="Algorithm">
<associationConnector edgePoints="[(6 : 7.45274983723958); (7.125 : 7.45274983723958); (7.125 : 3.02089680989583)]" fixedFrom="NotFixed" fixedTo="NotFixed">
<AssociationMoniker Name="/CMDataContext/EMPLOYEE/EMPLOYEE_BILL" />
<nodes>
<classShapeMoniker Id="3a64c501-67da-4ab5-9a9d-1186b788e2f6" />
Expand All @@ -59,14 +59,14 @@
<elementListCompartment Id="6898b8a7-5a40-49c5-9457-9c5cfb4ab415" absoluteBounds="0.76500000000000012, 2.335, 1.9700000000000002, 0.8262939453125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
</nestedChildShapes>
</classShape>
<associationConnector edgePoints="[(6.125 : 2.73484537760417); (2.75 : 2.73484537760417)]" fixedFrom="Algorithm" fixedTo="Algorithm">
<associationConnector edgePoints="[(6.125 : 2.73484537760417); (2.75 : 2.73484537760417)]" fixedFrom="NotFixed" fixedTo="NotFixed">
<AssociationMoniker Name="/CMDataContext/BILL/BILL_PRODUCT_BILL" />
<nodes>
<classShapeMoniker Id="281f129c-fda8-4bbc-b4ef-b97a384bee8f" />
<classShapeMoniker Id="5391ea21-1485-4bb9-abb8-8832b0d391fe" />
</nodes>
</associationConnector>
<associationConnector edgePoints="[(8.875 : 6.375); (8.5 : 6); (8.5 : 3.6362939453125); (7.20833333333333 : 3.6362939453125 : JumpStart); (7.04166666666667 : 3.6362939453125 : JumpEnd); (6.05208333333333 : 3.6362939453125 : JumpStart); (5.88541666666667 : 3.6362939453125 : JumpEnd); (3.125 : 3.6362939453125); (2.75 : 3.2612939453125)]" fixedFrom="NotFixed" fixedTo="NotFixed">
<associationConnector edgePoints="[(8.90822235486779 : 6.375); (8.5 : 5.96677764513221); (8.5 : 3.6362939453125); (7.20833333333333 : 3.6362939453125 : JumpStart); (7.04166666666667 : 3.6362939453125 : JumpEnd); (6.05208333333333 : 3.6362939453125 : JumpStart); (5.88541666666667 : 3.6362939453125 : JumpEnd); (3.125 : 3.6362939453125); (2.75 : 3.2612939453125)]" fixedFrom="NotFixed" fixedTo="NotFixed">
<AssociationMoniker Name="/CMDataContext/PRODUCT/PRODUCT_PRODUCT_BILL" />
<nodes>
<classShapeMoniker Id="bd0aa91c-acf3-4197-8342-52b4b8aaf9ed" />
Expand All @@ -79,12 +79,25 @@
<elementListCompartment Id="da9b0b0a-cdef-4887-8936-8eb49c9b1a56" absoluteBounds="0.76500000000000012, 4.96, 1.9700000000000002, 0.63399251302083326" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
</nestedChildShapes>
</classShape>
<associationConnector edgePoints="[(2.75 : 5.09699625651042); (5.88541666666667 : 5.09699625651042 : JumpStart); (6.05208333333333 : 5.09699625651042 : JumpEnd); (7.04166666666667 : 5.09699625651042 : JumpStart); (7.20833333333333 : 5.09699625651042 : JumpEnd); (8.41666666666667 : 5.09699625651042 : JumpStart); (8.58333333333333 : 5.09699625651042 : JumpEnd); (9.9062525 : 5.09699625651042); (9.9062525 : 6.375)]" fixedFrom="Algorithm" fixedTo="Algorithm">
<associationConnector edgePoints="[(2.75 : 5.69399251302083); (3.125 : 6.06899251302083); (3.125 : 6); (5.88541666666667 : 6 : JumpStart); (6.05208333333333 : 6 : JumpEnd); (7.04166666666667 : 6 : JumpStart); (7.20833333333333 : 6 : JumpEnd); (8.4682867976262 : 6); (8.875 : 6.4067132023738)]" fixedFrom="NotFixed" fixedTo="NotFixed">
<AssociationMoniker Name="/CMDataContext/PRODUCTTYPE/PRODUCTTYPE_PRODUCT" />
<nodes>
<classShapeMoniker Id="8d14706c-6065-438a-9979-0fcf810d4cff" />
<classShapeMoniker Id="bd0aa91c-acf3-4197-8342-52b4b8aaf9ed" />
</nodes>
</associationConnector>
<classShape Id="a40383e5-610a-4257-80b3-c197cdf01ee4" absoluteBounds="8.875, 4.125, 2, 1.1939925130208333">
<DataClassMoniker Name="/CMDataContext/ACCOUNT_IMAGE" />
<nestedChildShapes>
<elementListCompartment Id="201bc2d7-8e2d-419e-878d-4c7a1847f920" absoluteBounds="8.89, 4.585, 1.9700000000000002, 0.63399251302083326" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
</nestedChildShapes>
</classShape>
<associationConnector edgePoints="[(10.3125 : 3.2131982421875); (10.3125 : 4.125)]" fixedFrom="Algorithm" fixedTo="Algorithm">
<AssociationMoniker Name="/CMDataContext/ACCOUNT/ACCOUNT_ACCOUNT_IMAGE" />
<nodes>
<classShapeMoniker Id="06e1b7ec-d503-4025-9491-7ec236d7b5da" />
<classShapeMoniker Id="a40383e5-610a-4257-80b3-c197cdf01ee4" />
</nodes>
</associationConnector>
</nestedChildShapes>
</ordesignerObjectsDiagram>
170 changes: 170 additions & 0 deletions source/CafeteriaManagement/CM.DAL/CM.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b4ebe86

Please sign in to comment.