Example #1
0
        public string SaveProjectStatus(string ProjectLink, string Flag)
        {
            // UPDATE STATUS OF THE PROJECT
            string msg = "";

            clsProjectMaster obj = new clsProjectMaster();
            // CREATE LIST OF THE FIELD WHICH ONLY NEED TO UPDATE.
            List <string> lst = new List <string>();

            lst.Add("Link");
            obj.Link = Convert.ToInt32(ProjectLink);
            lst.Add("Flag");
            obj.Flag = Flag;
            // THIS CREATE A QUERY OF THE COLUMN WHICH DEFINE INTO THE LIST.
            clsIFrameWork.SetDependentTable(obj, lst);


            bool issucc = false;

            try
            {
                // TRACACTION IS EXECUTE , SO ABOVE CREATED ALL QUERY WILL EXECUTE AT SAME TIME.
                issucc = clsIFrameWork.FireTransaction();
            }
            catch (Exception ex)
            {
                // ERROR LOG
                FileStream fs = new FileStream(ServerLogFile, FileMode.Append, FileAccess.Write, FileShare.Write);
                fs.Close();
                StreamWriter sw = new StreamWriter(ServerLogFile, true, Encoding.ASCII);
                sw.WriteLine(ex.ToString() + System.DateTime.Now.ToString());
                sw.Close();
                msg = ex.Message;
            }
            if (issucc)
            {
                return("");
            }
            else
            {
                return(msg);
            }
        }
Example #2
0
        public string SaveProject(clsProjectMaster ProjectMaster, string notify)
        {
            string msg         = "";
            int    nextDocNo   = 0;
            string FormattedNo = "";

            string CompanyLink = HttpContext.Current.Request.Cookies["CompanyLink"].Value.ToString();

            // PROJECT OBJECT
            clsProjectMaster obj = ProjectMaster;

            obj.IsDeactivate = false;
            obj.CompanyLink  = HttpContext.Current.Request.Cookies["CompanyLink"].Value;
            obj.AreaLink     = DatabaseConnectionSqlServer.ExecuteScalarInternal("Select Link from AreaMaster where areamaster.isdeactivate=0 and areamaster.name Like '%" + obj.City + "%'");

            // LINK 0 THEN INSERT ELSE UPDATE RECORD
            if (obj.Link == 0)
            {
                DataTable dtNext = clsMethods.GetDocNo("PR");
                if (dtNext.Rows.Count > 0)
                {
                    // GET NEXT CUSTOMER NUMBER , NUMBER WILL BE LIKE THIS : PR00001
                    nextDocNo   = Convert.ToInt32(dtNext.Rows[0]["Next_Doc_No"].ToString());
                    FormattedNo = clsMethods.FormatDocumentNo("PR", Convert.ToDecimal(nextDocNo));
                }
                obj.ProjectNo = FormattedNo;

                // CREATED BY , CREATED HOST NAME, DATE OF CREATION FOR ALL THE RECORD WHICH IS INSERT FOR ALL TABLE
                obj.CreatedBy       = Convert.ToInt32(HttpContext.Current.Request.Cookies["UserId"].Value);
                obj.CreatedHostName = HttpContext.Current.Request.UserHostName;
                obj.DateOfCreation  = DateTime.Now;
            }
            else
            {
                // MODIFIED BY , MODIFIED HOST , MODIFIED DATE WHEN RECORD UPDATE.
                obj.ModifiedBy         = Convert.ToInt32(HttpContext.Current.Request.Cookies["UserId"].Value);
                obj.ModifiedHostName   = HttpContext.Current.Request.UserHostName;
                obj.DateOfModification = DateTime.Now;
            }

            clsIFrameWork.SetIndependentTable(obj);

            if (notify == "1")
            {
                // SEND MAIL
                DataTable dtEmail = DatabaseConnectionSqlServer.GetDataTable("Select Email from UserMaster where usermaster.Link = " + obj.SalesRepresentive);
                if (dtEmail.Rows.Count > 0)
                {
                    string Email = dtEmail.Rows[0]["Email"].ToString();
                    bool   mail  = clsMethods.SendMail("Project Creation", obj.InitialRequirement, Email, CompanyLink);
                }
            }


            bool issucc = false;

            try
            {
                // TRACACTION IS EXECUTE , SO ABOVE CREATED ALL QUERY WILL EXECUTE AT SAME TIME.
                issucc = clsIFrameWork.FireTransaction();
            }
            catch (Exception ex)
            {
                // ERROR LOG
                FileStream fs = new FileStream(ServerLogFile, FileMode.Append, FileAccess.Write, FileShare.Write);
                fs.Close();
                StreamWriter sw = new StreamWriter(ServerLogFile, true, Encoding.ASCII);
                sw.WriteLine(ex.ToString() + System.DateTime.Now.ToString());
                sw.Close();
                msg = ex.Message;
            }
            return(msg);
        }